matlab拟合三次多项式 常数项为0 已知x,y对应的数据点,求y=184.56x+Ax^2+Bx^3,用什么方法可以拟合得出? 5
展开全部
追问
x=[0,0.005,0.01,0.03,0.06,0.08,0.10,0.13,0.15,0.18,0.22,0.25,0.28,0.31,0.34,0.37,0.39,0.41,0.44,0.46,0.48];
y=[0,0.16,2.10,5.43,10.65,16.14,20.67,27.32,32.62,40.60,52.05,61.86,70.52,80.50,90.80,100.67,110.44,120.05,130.51,140.24,151.41];
用上述数据做不出来啊
追答
因为x(1)=0,x的平方作分母时,分母为0,Y(1)非数,故得不到A,B
clear;clc;close all;
x=[0,0.005,0.01,0.03,0.06,0.08,0.10,0.13,0.15,0.18,0.22,0.25,0.28,0.31,0.34,0.37,0.39,0.41,0.44,0.46,0.48];
y=[0,0.16,2.10,5.43,10.65,16.14,20.67,27.32,32.62,40.60,52.05,61.86,70.52,80.50,90.80,100.67,110.44,120.05,130.51,140.24,151.41];
Y=(y-184.56.*x)./(x.^2+eps);%化为Y=A+Bx;
T=polyfit(x,Y,1);%将Y拟合成关于x的一次多项式
%输出A和B:
B=T(1)
A=T(2)
Y=A+B.*x;
y1=Y.*x.^2+184.56.*x;%y1=184.56x+Ax^2+Bx^3
plot(x,y);hold on;
plot(x,y1,'r');hold off;
运行结果为:
B =
1.2008e+004=12008
A =
-3.8451e+003=-3845.1
从图像上看,y不成x的四次函数。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询