作业帮 > 综合 > 作业

求MATLAB 拟合指数函数的代码~

来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/06/25 00:09:01
求MATLAB 拟合指数函数的代码~
x=[50 150 250 350 450 550 650]
y=[0.658415842 0.193069307 0.080858086 0.044554455 0.01650165 0.00330033 0.00330033]
想要拟合成y=a*exp(b*x)的形式~
求MATLAB 拟合指数函数的代码~
x=[50 150 250 350 450 550 650]';
y=[0.658415842 0.193069307 0.080858086 0.044554455 0.01650165 0.00330033 0.00330033]';
st_ = [7 -5.e-005 ];
ft_ = fittype('a*exp(b*x)',...
    'dependent',{'y'},'independent',{'x'},...
    'coefficients',{'a', 'b'});
cf_ = fit(x,y,ft_,'Startpoint',st_)
plot(cf_,'fit',0.95);hold on,plot(x,y,'*') 
cf_ = 
     General model:
       cf_(x) = a*exp(b*x)
     Coefficients (with 95% confidence bounds):
       a =       1.157  (1.03, 1.284)
       b =    -0.01137  (-0.01292, -0.009823)