Predictor and Response Variables must have same length error
Show older comments
Hello,
I am attempting to use fitnlm, and come across an error I don't understand.
x =[p;l];
model=@(b,x)((x(1,:)+x(2,:)+b(2))-sqrt((x(1,:)+x(2,:)+b(2)).^2)-(4*x(1,:)*x(2,:)))*(b(1)/(2*x(1,:)));
beta0=[0.1,1];
for i=1:rows
y=csp(i,:)
x
size(x(1,:))
size(x(2,:))
size(y)
fitnlm(x,y,model,beta0)
end
Issue is, the x and y are the same length so I don't quite know why I'm getting this error
y =
0 0 0 0 0 0 0 0 0
x =
0.1500 0.1800 0.1900 0.2100 0.2300 0.2500 0.2600 0.2800 0.3000
1.1000 0.8800 0.7700 0.6300 0.4700 0.3700 0.2600 0.1400 0
ans =
1 9
ans =
1 9
ans =
1 9
Accepted Answer
More Answers (0)
Categories
Find more on Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!