polyfit and polyval problem

조회 수: 1 (최근 30일)
Paul Rogers
Paul Rogers 2019년 12월 5일
편집: Paul Rogers 2019년 12월 6일
Hi there,
I am trying to plot a line using the ployfit and command
x and y are the coordinates in attached xy the plot.
I can't plot a polyfit curve that reproduces the original.
I alway came up with something different from the original curve.
  댓글 수: 8
dpb
dpb 2019년 12월 6일
Here ya' go, IA...xy.jpg
dpb
dpb 2019년 12월 6일
"I got the y from a more complex equation, ..."
Well, there's the place to start. What makes sense to approximate whatever that is/was.
What restrictions are on the approximation used, if any?

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

채택된 답변

Paul Rogers
Paul Rogers 2019년 12월 6일
편집: Paul Rogers 2019년 12월 6일
here we are, I think I found the solution.
I can select only a portion of that curve and take the x and y values,
then the code it's this
p1=polyfit(x,y,4);
t_intrest=[0.2:0.1:0.4];
y_intrested=polyval(p1,t_intrest);
plot(x,y);
hold on
plot(t_intrest,y_intrested);
hold on
In attaced the new x and y.
Now it's up to me to find the largest portion possible where I can use polyfit.
  댓글 수: 5
Guillaume
Guillaume 2019년 12월 6일
I'm not sure how many times we can say it, your curve is nothing like a polynomial and attempting to fit a polynomial to it is the wrong approach.
To me it looks like your curve may be a log-normal curve. Again, some information on what created that curve could tell you that.
Paul Rogers
Paul Rogers 2019년 12월 6일
편집: Paul Rogers 2019년 12월 6일
I am trying to find a polynomial approx for that curve. I don't mean on its ooverall domain, it would be good even on a portion of that.
For example, I found that from 0 to 0.8 (more or less), it could be use this method.
P.S.
Thanks everyone for the help.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by