How to find the polynomial coefficients of two Array

2 次查看(过去 30 天)
I have such data from a thesis as below:
x=[1/1800,1/60,1/3,1,2,4,8,24];
y1=[0.7291,3.1663,4.3217,6.5508,9.1189,16.2679,30.3524,44.7320];
y2=[0.4572,1.7790,5.2580,13.7910,30.1775,64.9784,109.7704,136.0388];
The author said he can get the chart as below after smooth processing the data.
Also,he can get the Polynomial coefficients:
r1 = 3. 550, 1. 788, 0. 6734, - 0. 09003, 0. 004448, 9. 396e-5, 6. 675e-7
r2= 1. 709, 8. 714, 4. 178, - 0. 8004, 0. 05731, - 0. 001856, 2. 277e- 5
I can figure out the chart by using
xi = 0:0.1:25;
yi1 = interp1(x,y1,xi,'pchip');
yi2 = interp1(x,y2,xi,'pchip');
plot(xi,yi1,'b:',xi,yi2,'r-');
This is the picture:
However, i get the Polynomial coefficients as below:
py1= polyfit(xi,yi1,6);
py2= polyfit(xi,yi2,6);
py1 =
0.0000 -0.0002 0.0056 -0.0851 0.4458 3.1673 1.4525
py2 =
0.0000 -0.0016 0.0498 -0.6844 3.3783 10.8772 0.1662
the Polynomial coefficients were quite different from the author's.
I don't konw if i missed any steps or which step is wrong.
I think maybe the error is happened when smooth processing the data.The author didn't tell which method he used to processing the data, while i just used the interp1 method.
I want to get the same coeffcients as the author.Any sugguestion about the processing method?
Any help would be kindly, many thanks!
  1 个评论
Matt J
Matt J 2013-6-2
I think maybe the error is happened when smooth processing the data.The author didn't tell which method he used to processing the data, while i just used the interp1 method.
Interpolation doesn't smooth the data in any way.

请先登录,再进行评论。

采纳的回答

Matt J
Matt J 2013-6-2
编辑:Matt J 2013-6-2
the Polynomial coefficients were quite different from the author's.
You're using a very small amount of data to perform the fit (only 1 more data point than the number of unknown coefficients).
In addition, it's a 6th-order polynomial. Fitting at an order that high is starting to get fairly ill-conditioned,
>> cond(vander(0:6))
ans =
1.5973e+06
  1 个评论
Alex
Alex 2013-6-8
Thanks very much! Yor are right, i can't fit it directly with polynomial. My finnal method is using interp1(x,Lind,xi,'pchip') to smooth the line, then using 6th-order polynomial to get the coefficients.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Polynomials 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by