>> x=[0 0.1 0.2 0.4 0.6 0.8 1];y=[7.53 7.04 6.2 4.8 3.57 3.03 2.54];
fitType=fittype('7.53-a*log(1+b*x)','independent','x','coefficients',{'a','b'})
fit(x',y',fitType)
fitType =
General model: fitType(a,b,x) = 7.53-a*log(1+b*x)
Warning: Start point not provided, choosing random start point.
> In Warning>Warning.throw at 31
In fit>iFit at 320
In fit at 109
ans =
General model: ans(x) = 7.53-a*log(1+b*x)
Coefficients (with 95% confidence bounds):
a = 5.522 (0.9524, 10.09)
b = 1.555 (-0.2776, 3.388)
这样行不行?
再问: 可以的,请问我自己要怎么输才能出来图象
再答: 这是在cftool中自动生成的,你可以直接在cftool直接拟合,不用编程,命令窗口键入cftool,即可打开,具体用法请看help可改为以下程序x=[0 0.1 0.2 0.4 0.6 0.8 1];y=[7.53 7.04 6.2 4.8 3.57 3.03 2.54];fitType=fittype('7.53-a*log(1+b*x)','independent','x','coefficients',{'a','b'})fit_y=fit(x',y',fitType); plot(fit_y) hold onplot(x,y,'o')