matlab用最小二乘法求一形如Y=ct^m(c和m为待定系数)的多项式,使之与下列数据相拟合,
题目:matlab用最小二乘法求一形如Y=ct^m(c和m为待定系数)的多项式,使之与下列数据相拟合,数据如下(19,19.0)(25,32.3)(31,49.0)(38...
题目:matlab用最小二乘法求一形如Y=ct^m(c和m为待定系数)的多项式,使之与下列数据相拟合,数据如下(19,19.0)(25,32.3)(31,49.0)(38,73.3)(44,97.8) 为什么运行不成功?
t=[19 25 31 38 44];
y=[19 32.3 49 73.8 97.8];
y=y';
t=t';
st_=[0.5 0.5];
ft_=fittype('c*t^m','dependent',{'y'},'indepdent',{'t'},'coefficients',{'c','m'});
[cf,good]=fit(t,y,ft_,'Startpoint',st_)
h_=plot(cf,'fit',0.95);
legend off;
set(h_(1),'Color',[1 0 0],'LineStyle','-', 'LineWidth',2,'Marker','none', 'MarkerSize',6);
hold on,plot(t,y,'*') 展开
t=[19 25 31 38 44];
y=[19 32.3 49 73.8 97.8];
y=y';
t=t';
st_=[0.5 0.5];
ft_=fittype('c*t^m','dependent',{'y'},'indepdent',{'t'},'coefficients',{'c','m'});
[cf,good]=fit(t,y,ft_,'Startpoint',st_)
h_=plot(cf,'fit',0.95);
legend off;
set(h_(1),'Color',[1 0 0],'LineStyle','-', 'LineWidth',2,'Marker','none', 'MarkerSize',6);
hold on,plot(t,y,'*') 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询