matlab用lsqcurvefit拟合老是出现问题 m函数 function f=lvtao(a,x,t) f=a(1)+(a(2)-a(1))*(1-erf(x/(2*sqrt(a(3)*t)))); end 运行 x=[2.5 7.5 12.5 17.5 22.5 27.5 32.5 37.5]; f=[0.035657 0.033777 0.02796 0.026493 0.023119 0.017634 0.007413 0.0027
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 07:29:38
matlab用lsqcurvefit拟合老是出现问题 m函数 function f=lvtao(a,x,t) f=a(1)+(a(2)-a(1))*(1-erf(x/(2*sqrt(a(3)*t)))); end 运行 x=[2.5 7.5 12.5 17.5 22.5 27.5 32.5 37.5]; f=[0.035657 0.033777 0.02796 0.026493 0.023119 0.017634 0.007413 0.0027
matlab用lsqcurvefit拟合老是出现问题
m函数 function f=lvtao(a,x,t) f=a(1)+(a(2)-a(1))*(1-erf(x/(2*sqrt(a(3)*t)))); end 运行 x=[2.5 7.5 12.5 17.5 22.5 27.5 32.5 37.5]; f=[0.035657 0.033777 0.02796 0.026493 0.023119 0.017634 0.007413 0.002796]; t=10220; a0=[0.05 0.5 0.5]; a=lsqcurvefit(@lvtao,a0,x,f) 结果Error using lvtao (line 2) Not enough input arguments.Error in lsqcurvefit (line 199) initVals.F = feval(f
matlab用lsqcurvefit拟合老是出现问题 m函数 function f=lvtao(a,x,t) f=a(1)+(a(2)-a(1))*(1-erf(x/(2*sqrt(a(3)*t)))); end 运行 x=[2.5 7.5 12.5 17.5 22.5 27.5 32.5 37.5]; f=[0.035657 0.033777 0.02796 0.026493 0.023119 0.017634 0.007413 0.0027
自定义函数定义错误.可以改写为
function f=lvtao(a,x)
t=10220;
f=a(1)+(a(2)-a(1))*(1-erf(x/(2*sqrt(a(3)*t))));
end
>>x=[2.5 7.5 12.5 17.5 22.5 27.5 32.5 37.5];
>>f=[0.035657 0.033777 0.02796 0.026493 0.023119 0.017634 0.007413 0.002796];
>>a0=[0.05 0.5 0.5];
a=lsqcurvefit(@lvtao,a0,x,f)
运行结果
a =
-0.0711 0.0409 0.4183