关于用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. 楼主,你看看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对调一下就能拟合出来了。 把X、Y对调下就好办了 前来学习,我知道拟合曲线用cftool 前来学习,我知道拟合曲线用cftool 前来学习,我知道拟合曲线用cftool 请问一下cftool能够得到拟合的曲线表达式吗? cftool好像要选定拟合的曲线类型吧,会拟合出曲线的各个参数的,那么也就知道了方程的具体表达式了 是的,cftool也可以实现多项式拟合,拟合后参数会列表显示。 我推荐拟合使用1stopt,这个软件非常便于使用。
页:
[1]