필터 지우기
필터 지우기

cubic ploynomial fitting problem

조회 수: 7 (최근 30일)
aditi
aditi 2014년 5월 26일
댓글: John D'Errico 2014년 5월 26일
Hi,
I have 8 points ina data file on which m fitting cubic polynomial.. when i do fitting using cftool den i get a smooth fitting curve..
but if i use polyfit and polyval commands and plot then the fit curve is not that smooth.. how can i get a similar fitting curve like i get in cftool...
plz anybody help me with it
  댓글 수: 2
dpb
dpb 2014년 5월 26일
Have to see what actually did -- was it the same data?
John D'Errico
John D'Errico 2014년 5월 26일
As those who answered this have said, you must use more then 8 points to plot. Otherwise, plot just does connect-the-dots with straight line segments.

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

답변 (2개)

Matt J
Matt J 2014년 5월 26일
Try plotting the curve at more than 8 points, e.g., 1000.

Star Strider
Star Strider 2014년 5월 26일
If x and y are your data:
x = ...
y = ...
p = polyfit(x,y,3); % Fit data
xp = linspace(min(x), max(x), 200); % Create 200 points linearly-spaced in x
yfit = polyval(p, xp);
Then plot your data as (x,y) and the fit as (xp,yfit).

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by