关于matlab中lsqcurvefit函数应用出错的问题x=[300.317 305.083 309.848 315.207 319.97 325.327 330.087 335.441 340.2 344.957 ];y=[5.45873 6.79679 7.79155 9.2996 10.58554 12.15892 14.06855 16.22598 18.77455 21.42668];a0=[1,2400];[x,resnorm]=ls
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/20 02:45:24
关于matlab中lsqcurvefit函数应用出错的问题x=[300.317 305.083 309.848 315.207 319.97 325.327 330.087 335.441 340.2 344.957 ];y=[5.45873 6.79679 7.79155 9.2996 10.58554 12.15892 14.06855 16.22598 18.77455 21.42668];a0=[1,2400];[x,resnorm]=ls
关于matlab中lsqcurvefit函数应用出错的问题
x=[300.317 305.083 309.848 315.207 319.97 325.327 330.087 335.441 340.2 344.957 ];
y=[5.45873 6.79679 7.79155 9.2996 10.58554 12.15892 14.06855 16.22598 18.77455 21.42668];
a0=[1,2400];
[x,resnorm]=lsqcurvefit(@fun,a0,x,y)
a= lsqcurvefit(@fun,a0,x,y)
function y=fun(a,x)
y=a(1)*3.7418*10^-16/((x*10^-9)^5*(exp(0.014388/(a(2)*x*10^-9))-1))
运行时出现:
? Error using ==> f:/安装软件/matlab/toolbox/optim/private/lsqncommon
User supplied function failed with the following error:
Error using ==> feval
Undefined function 'fun'.
Error in ==> F:\安装软件\matlab\toolbox\optim\lsqcurvefit.m
On line 129 ==> [x,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...
请教位高手帮忙解决下
中间那两个语句重复了
关于matlab中lsqcurvefit函数应用出错的问题x=[300.317 305.083 309.848 315.207 319.97 325.327 330.087 335.441 340.2 344.957 ];y=[5.45873 6.79679 7.79155 9.2996 10.58554 12.15892 14.06855 16.22598 18.77455 21.42668];a0=[1,2400];[x,resnorm]=ls
改成:
x=[300.317 305.083 309.848 315.207 319.97 325.327 330.087 335.441 340.2 344.957 ];
y=[5.45873 6.79679 7.79155 9.2996 10.58554 12.15892 14.06855 16.22598 18.77455 21.42668];
a0=[1,2400];
[a,resnorm]=lsqcurvefit(@fun,a0,x,y);
再把a= lsqcurvefit(@fun,a0,x,y)这句话去掉,你刚才的定义改变了x的值,再引用x时当然维数不对了.