matlab进行复杂函数的拟合
functionF=myfun(x,xdata)F=x(1)-((xdata-x(2))^x(3))/x(4)xdata=[211.0203.0181.0198.0308...
function F=myfun(x,xdata)
F=x(1)-((xdata-x(2))^x(3))/x(4)
xdata=[211.0 203.0 181.0 198.0 308.0 279.0 282.0 300.0 300.0 395.0 397.5 420.0 520.0 500.0];
ydata=[0.539426329 0.549146493 0.55177182 0.552454165 0.531121066 0.543953678 0.445927983 0.44839669 0.54054826 0.479326121 0.480062915 0.475330964 0.432280448 0.427907858]
x0=[0.85 450 5 150];
[x,resnorm]=lsqcurvefit(@myfun,x0,xdata,ydata)
提示的错误是
??? Error using ==> optim\private\lsqncommon at 98
LSQCURVEFIT cannot continue because user supplied objective function failed with the following error:
Error using ==> mpower
Matrix must be square.
Error in ==> lsqcurvefit at 182
[x,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ... 展开
F=x(1)-((xdata-x(2))^x(3))/x(4)
xdata=[211.0 203.0 181.0 198.0 308.0 279.0 282.0 300.0 300.0 395.0 397.5 420.0 520.0 500.0];
ydata=[0.539426329 0.549146493 0.55177182 0.552454165 0.531121066 0.543953678 0.445927983 0.44839669 0.54054826 0.479326121 0.480062915 0.475330964 0.432280448 0.427907858]
x0=[0.85 450 5 150];
[x,resnorm]=lsqcurvefit(@myfun,x0,xdata,ydata)
提示的错误是
??? Error using ==> optim\private\lsqncommon at 98
LSQCURVEFIT cannot continue because user supplied objective function failed with the following error:
Error using ==> mpower
Matrix must be square.
Error in ==> lsqcurvefit at 182
[x,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ... 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询