matlab 最小二乘拟合曲线哪里出了错求支援啊!>> t=>> t=[0.25,0.5,0.75,1,1.5,2,2.5,3,3.5,4,4.5,5,6,7,8,9,10,11,12,13,14,15,16];>> c2=[30,68,75,82,77,68,68,58,51,50,41,38,35,28,25,18,15,12,10,7,7,4];>> b=c2/102.04;>> f=inline('a(1)/(a(2)-
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/30 11:26:14
matlab 最小二乘拟合曲线哪里出了错求支援啊!>> t=>> t=[0.25,0.5,0.75,1,1.5,2,2.5,3,3.5,4,4.5,5,6,7,8,9,10,11,12,13,14,15,16];>> c2=[30,68,75,82,77,68,68,58,51,50,41,38,35,28,25,18,15,12,10,7,7,4];>> b=c2/102.04;>> f=inline('a(1)/(a(2)-
matlab 最小二乘拟合曲线
哪里出了错求支援啊!>> t=
>> t=[0.25,0.5,0.75,1,1.5,2,2.5,3,3.5,4,4.5,5,6,7,8,9,10,11,12,13,14,15,16];
>> c2=[30,68,75,82,77,68,68,58,51,50,41,38,35,28,25,18,15,12,10,7,7,4];
>> b=c2/102.04;
>> f=inline('a(1)/(a(2)-a(1))*(exp(-a(1)*t)-exp(-a(2)*t))','a','t');
>> [a,J]=Isqcurvefit(f,[2,1],t,c2);
Undefined function or method 'Isqcurvefit' for input arguments of type
'inline'.
matlab 最小二乘拟合曲线哪里出了错求支援啊!>> t=>> t=[0.25,0.5,0.75,1,1.5,2,2.5,3,3.5,4,4.5,5,6,7,8,9,10,11,12,13,14,15,16];>> c2=[30,68,75,82,77,68,68,58,51,50,41,38,35,28,25,18,15,12,10,7,7,4];>> b=c2/102.04;>> f=inline('a(1)/(a(2)-
出错在于函数不能用inline定义,改用匿名函数@,如:
t=[0.25,0.5,0.75,1,1.5,2,2.5,3,3.5,4,4.5,5,6,7,8,9,10,11,12,13,14,15,16];
c2=[30,68,75,82,77,68,68,58,51,50,41,38,35,28,25,18,15,12,10,7,7,4];
b=c2/102.04;
f=@(a,t)a(1)/(a(2)-a(1))*(exp(-a(1)*t)-exp(-a(2)*t));
[a,J]=lsqcurvefit(f,[2,1],t,c2);
? Error using ==> lsqncommon at 134
Function value and YDATA sizes are incommensurate.
Error in ==> lsqcurvefit at 186
错在你给出的t,c2数据个数不同,改为
t=[0.25,0.5,0.75,1,1.5,2,2.5,3,3.5,4,4.5,5,6,7,8,9,10,11,12,13,14,15];
c2=[30,68,75,82,77,68,68,58,51,50,41,38,35,28,25,18,15,12,10,7,7,4];
%b=c2/102.04;
f=@(a,t)a(1)/(a(2)-a(1))*(exp(-a(1)*t)-exp(-a(2)*t));
[a,J]=lsqcurvefit(f,[2,1],t,c2);
Maximum number of function evaluations exceeded;
increase options.MaxFunEvals
[x,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...
计算次数超过最大值,说明你的数据不适合这种拟合,得不出结果