matlab题:对于函数f(x)=1⼀(1+25x^2),在区间[-1,1]上取Xi=-1+0.2*i(i=0,1,…,10),试求三次曲线拟

试求三次曲线拟合?回答者,给高分!
2024-12-03 09:36:11
推荐回答(1个)
回答1:

i = 0:10;
x = -1+0.2*i;
y = 1./(1+25*x.^2);
p=polyfit(x,y,3);
s=vpa(poly2sym(p))
f = polyval(p,x);
plot( x, f, x, y, 'o ')

三次曲线拟合结果:
s = -.18688658920776270929651442156525e-15*x^3-.57518273581621997911590671771667*x^2+.10642860455919865470368948113046e-15*x+.48412492484890679023123993829358