主题:函数文件出错???
函数文件:
function ymax=my(x,y)
myfun=inline('beta(1)*exp(-beta(3)*(x+beta(4)).^2)+beta(2)','beta','x');
data=nlinfit(x,y,myfun,[0.4 1 1 -1]);
a=data(1);b=data(2);c=data(3);d=data(4);
%求最大值和所位值
ymax=a+b;
>> my([1,1.5,2],[0.7856,0.6008,0.6000])
NLINFIT did NOT converge. Returning results from last iteration.
ans =
3.1239
这个函数文件不值错在哪里,请高手帮忙,谢谢!
function ymax=my(x,y)
myfun=inline('beta(1)*exp(-beta(3)*(x+beta(4)).^2)+beta(2)','beta','x');
data=nlinfit(x,y,myfun,[0.4 1 1 -1]);
a=data(1);b=data(2);c=data(3);d=data(4);
%求最大值和所位值
ymax=a+b;
>> my([1,1.5,2],[0.7856,0.6008,0.6000])
NLINFIT did NOT converge. Returning results from last iteration.
ans =
3.1239
这个函数文件不值错在哪里,请高手帮忙,谢谢!