matlab中lsqcurvefit函数报错问题
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/11 16:20:50
matlab中lsqcurvefit函数报错问题
函数程序:
function f=myfun(a,x)
f=a(1)*35*exp(a(2)*x+a(3)*x^2);
命令:
x=[11.6 12.8 14.1 14.4 13.9 13 12.4];
y=[-0.3 -1 -1.48 -1.16 -1.26 -0.67 -0.73];
a0=[0,0];
[x,Resnorm]=lsqcurvefit(@myfun,a0,x,y)
报错:
Error using ==> optim\private\lsqncommon at 98
LSQCURVEFIT cannot continue because user supplied objective function failed with the following error:
Attempted to access a(3); index out of bounds because numel(a)=2.
Error in ==> lsqcurvefit at 182
[x,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...
函数程序:
function f=myfun(a,x)
f=a(1)*35*exp(a(2)*x+a(3)*x^2);
命令:
x=[11.6 12.8 14.1 14.4 13.9 13 12.4];
y=[-0.3 -1 -1.48 -1.16 -1.26 -0.67 -0.73];
a0=[0,0];
[x,Resnorm]=lsqcurvefit(@myfun,a0,x,y)
报错:
Error using ==> optim\private\lsqncommon at 98
LSQCURVEFIT cannot continue because user supplied objective function failed with the following error:
Attempted to access a(3); index out of bounds because numel(a)=2.
Error in ==> lsqcurvefit at 182
[x,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...
你自己定义的函数用到了a[3],但是你给的那个a0只有两项,他不知道该怎么办了.
matlab中lsqcurvefit函数报错问题
matlab中使用lsqcurvefit函数拟合老是报错,
lsqcurvefit在matlab中拟合函数问题
关于matlab中lsqcurvefit函数应用出错的问题
lsqcurvefit在matlab中拟合多元函数问题
matlab中lsqcurvefit函数拟合问题,有懂的请帮下忙,
matlab lsqcurvefit 函数的使用
如何使用matlab中的lsqcurvefit函数
matlab中使用polyfit函数报错
matlab的lsqcurvefit函数做幂函数拟合出错
Matlab 曲线拟合 lsqcurvefit函数问题,老是运行有错,但自己手动拟合的曲线拟合性很好,求大神帮忙解决
matlab中高斯拟合函数lsqcurvefit初始参数怎么设置