matlab曲线拟合的问题
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/19 10:56:49
matlab曲线拟合的问题
拟合F(P)=f(P)+E;其中f(P)=a*P +b*P+c;E=|g*sin(h*(P-Pmin )|
已知Pmin=60,p={120 160 180 200 220 240},F(P)={40 45 67 78 89 101}
要求a b c g h,
拟合F(P)=f(P)+E;其中f(P)=a*P +b*P+c;E=|g*sin(h*(P-Pmin )|
已知Pmin=60,p={120 160 180 200 220 240},F(P)={40 45 67 78 89 101}
要求a b c g h,
matlab里有个函数叫lsqcurvefit,可以做非线性拟合,给你个例子,照着写就可以了,注意需要给定abcgh的初值(你要根据实际情况来估计).另外,你的数据太少了,5个未知数,正好6组数据,拟合结果不一定能准确描述你的系统行为,建议至少有10组数据
x=0.019,0.023,0.027
y=430,380,256
3 parameters:a,b,c
target function:y=(a*(1-x/b)+x/b)^c
function Untitled3
clc
xi=[0.019,0.023,0.027];
yi=[430,380,256];
abc0=[4,0.5,5];
abc = lsqcurvefit(@fun,abc0,xi,yi)
function y = fun(abc,x)
y = (abc(1)*(1-x/abc(2))+x/abc(2)).^abc(3);
abc =
31.2588 -3.9585 1.7033
x=0.019,0.023,0.027
y=430,380,256
3 parameters:a,b,c
target function:y=(a*(1-x/b)+x/b)^c
function Untitled3
clc
xi=[0.019,0.023,0.027];
yi=[430,380,256];
abc0=[4,0.5,5];
abc = lsqcurvefit(@fun,abc0,xi,yi)
function y = fun(abc,x)
y = (abc(1)*(1-x/abc(2))+x/abc(2)).^abc(3);
abc =
31.2588 -3.9585 1.7033