How to find the polynomial coefficients of two Array
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/148163/image.gif)
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/148165/image.jpeg)
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 commentaire
Matt J
le 2 Juin 2013
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.
Réponse acceptée
Matt J
le 2 Juin 2013
Modifié(e) : Matt J
le 2 Juin 2013
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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Polynomials dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!