Originally Posted by
Bwts Hi
i am trying to obtain to constants using 'lsqcurvefit' here's the code,
xdata=stretch_r(:,2).';
ydata=stress_r.';
x0=[100; 1];
[x,resnorm]=lsqcurvefit(@MooneyRivlin,x0,xdata,ydata)
function F=MooneyRivlin(x,xdata)
F=(2*x(1)+2*x(2)/xdata)*(xdata-1/xdata^2);
Both 'stretch' and 'stress' are of length 14 but I keep getting the error,
??? Error using ==> optim\private\lsqncommon at 98
LSQCURVEFIT cannot continue because user supplied objective function failed with the following error:
Error using ==> mrdivide
Matrix dimensions must agree.
Error in ==> lsqcurvefit at 182
[x,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...
Error in ==> MonneyLSQ at 4
[x,resnorm]=lsqcurvefit(@MooneyRivlin,x0,xdata,ydata)
Any suggestions for this rather annoying error would be much appriciated thankyou.
Nic