求教matlab高手:

我有一组数据需要拟合出一个二次抛物线的方程,因为没接触过matlab,希望熟悉的朋友能够帮忙,谢谢。数据如下:x:0.025、0.05、0.075、0.1、0.125;y:0.2974、1.4646、2.1428、1.523、0.8303.希望得到:y=ax2+bx+c表达式中,参数a、b、c的值。

General model Gauss1:
f(x) = a1*exp(-((x-b1)/c1)^2)
Coefficients (with 95% confidence bounds):
a1 = 1.783 (1.422, 2.144)
b1 = 0.07899 (0.06948, 0.08851)
c1 = 0.05075 (0.03509, 0.06641)

Goodness of fit:
SSE: 0.001676
R-square: 0.9739
Adjusted R-square: 0.9478
RMSE: 0.02895

搞了好久,求采纳。。。
高斯函数比二次函数整出来的牛B。。。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-10-04
用matlab拟合工具箱
输入cftool,
Linear model Poly2:
f(x) = p1*x^2 + p2*x + p3
Coefficients (with 95% confidence bounds):
p1 = -573.5 (-933.1, -213.8)
p2 = 90.52 (35.53, 145.5)
p3 = -1.595 (-3.398, 0.2093)
Goodness of fit:
SSE: 0.07642
R-square: 0.9618
Adjusted R-square: 0.9236
RMSE: 0.1955
p1,p2,p3就是你要的a,b,c
第2个回答  2012-10-12
clear;clc;
hold on
grid on
x=[0.025,0.05,0.075,0.1,0.125];
y=[0.2974,1.4646,2.1428,1.523,0.8303];
p=polyfit(x,y,2); %用二次函数拟合,p就是a,b,c构成的向量

t=0:0.0001:0.15;
s=polyval(p,t,x);
plot(t,s)
plot(x,y,'r*')
p
结果:
p =

-573.4629 90.5162 -1.5945
第3个回答  2012-10-04