angelswd 发表于 2011-3-7 09:54:41

关于用matlab进行数据拟合

我想问一下,附件中的这种 曲线应该怎么来拟合呢
我用p=polyfit(zz,y,4);
zz是横坐标,y是纵坐标,在计算时出现下面警告
Warning: Polynomial is badly conditioned. Remove repeated data points
         or try centering and scaling as described in HELP POLYFIT.

mhkmars 发表于 2011-3-7 11:31:16

楼主,你看看help polyfit就知道错误在哪里了。
    P = POLYFIT(X,Y,N) finds the coefficients of a polynomial P(X) of
    degree N that fits the data Y best in a least-squares sense. P is a
    row vector of length N+1 containing the polynomial coefficients in
    descending powers, P(1)*X^N + P(2)*X^(N-1) +...+ P(N)*X + P(N+1).
这个命令式多项式函数拟合,既然是函数,纳闷一个自变量只能对应一个值才能叫做函数。看了你上面的图,如果横轴为x轴,纵轴为y轴,显然你画的不能叫做函数图象,做多称作圆锥曲线之类的。
所以,建议你先看懂要使用命令的应用条件。此外,对于你这个图,个人认为将x与y对调一下就能拟合出来了。

alenku 发表于 2011-3-8 22:07:12

把X、Y对调下就好办了

tianqiliu_2010 发表于 2011-3-14 13:24:21

前来学习,我知道拟合曲线用cftool

tianqiliu_2010 发表于 2011-3-14 13:23:36

前来学习,我知道拟合曲线用cftool

tianqiliu_2010 发表于 2011-3-14 14:01:41

前来学习,我知道拟合曲线用cftool

iryouott 发表于 2011-4-25 22:53:55

请问一下cftool能够得到拟合的曲线表达式吗?

南边的北边 发表于 2011-4-26 08:54:12

cftool好像要选定拟合的曲线类型吧,会拟合出曲线的各个参数的,那么也就知道了方程的具体表达式了

sanyuexiong 发表于 2011-4-26 10:12:21

是的,cftool也可以实现多项式拟合,拟合后参数会列表显示。

wxm27811 发表于 2011-4-27 14:08:19

我推荐拟合使用1stopt,这个软件非常便于使用。
页: [1]
查看完整版本: 关于用matlab进行数据拟合