Hei!
Can somebody help me with polynomial Interpolation in Matlab? I have a data set for x and y as vectors and N=15 as the order of polynomial.T o compute coefficient c I do as follows:
x=data(1,:);
>> y=data(2,:);
c=polyfit(x,n,14);
My question is what coefficient c is?
regards, Sergey

댓글 수: 1

Charles Garner
Charles Garner 2020년 9월 26일
my understanding is that C is arbitrary. Pick you own value.

댓글을 달려면 로그인하십시오.

 채택된 답변

the cyclist
the cyclist 2015년 5월 10일

0 개 추천

The output of polyfit is described in the very first sentence of the documentation here. Have you read that, and not understood it?
Also, in your code, what is n? Given how you have defined x and y, I would have expected your polynomial fit to be done with
polyfit(x,y,14)
Finally, I'm curious what your application of this is. I can't think of one where the fitting of a 15th-order polynomial is a good idea.

댓글 수: 4

Sergey Dukman
Sergey Dukman 2015년 5월 10일
Yes I have read that. It is understandable now. I have copied a wrong code from my script, sorry. It should be as you wrote
polyfit(x,y,14).
N=15 is polynomial order, that is I have 15 experimental data for Ethanol Equilibrium. I play with this data to get better understanding of polynomial in Matlab.
Thank you, sir.
John D'Errico
John D'Errico 2015년 5월 10일
That 14th degree polynomial fit is just a flat out bad idea. The interpolating polynomial will do obscene things BETWEEN the points, which is exactly what you want it for since you are interpolating.
Use an interpolating spline instead. Often pchip or spline will be a very good choice. So spend your time learning about them (and ppval, fnval, fnplt, etc), as well as interp1, a simple tool that incorporates both of those choices for splines. You can also find my SLM toolbox on the file exchange, which can help when you start realizing those spline tools have some issues too.
Star Strider
Star Strider 2015년 5월 10일
There must be a mathematical model of ethanol equilibrium available that estimates far fewer than 14 parameters from your 15 sets of data. Use that model, and fit it with one of the nonlinear parameter estimation functions (for example, nlinfit). It will give you a relatively accurate description of the process, and the estimated parameters will have physical meaning. As John has mentioned, throwing a 14-degree polynomial at it will likely confuse you more than enlighten you.
Charles Garner
Charles Garner 2020년 9월 26일
I am a co-author of a US Patent that uses curve fiitting. I think it is roughly 5th order. Patent #5706215. Related also to US Patent #5530925 In my telecom world, generally anything higher than 5 order isn't neccesary. You can play with it but it's not helpful.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Joan Triadó
Joan Triadó 2022년 2월 4일

0 개 추천

polynomial coefficients in descending powers

카테고리

도움말 센터File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

태그

질문:

2015년 5월 10일

답변:

2022년 2월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by