已知函数形式,如何用matlab把一组数据拟合从而求出未知参数?

已有一组数据x和y,
data1=xlsread('C:\Users\dell\Desktop\数据拟合\新建 Microsoft Excel 工作表.xlsx',1,'a1:a100');
data=xlsread('C:\Users\dell\Desktop\数据拟合\新建 Microsoft Excel 工作表.xlsx',1,'B1:B100');
x=[data1];
y=[data];
函数的形式是y=a^x*(b-c)+c求函数的系数a,b,c

第1个回答  推荐于2017-09-08
x=[1;1.5;2;2.5;3];
y=[0.9;1.7;2.2;2.6;3];
p=fittype('a*x.^0.5+b*lnx+c','independent','x')
f=fit(x,y,p)
plot(f,x,y);
上面是代码!
下面是结果:
a=2.818
b=0.8552
c=-0.6627追问

这个我找到过,按照这个编的程序算不出abc,

警告: Start point not provided, choosing random start point.
> In Warning>Warning.throw at 30
In fit>iFit at 312
In fit at 108
请问错误究竟出在哪了

本回答被提问者和网友采纳
相似回答