필터 지우기
필터 지우기

Fitting curve through data set

조회 수: 1 (최근 30일)
amberly hadden
amberly hadden 2014년 6월 9일
댓글: amberly hadden 2014년 6월 11일
Hi Im interested to plot XY which is a curve also Im interested to fit a best fit curve through data which should follow the data trend as is and then the point from where curve is changing or having maximum curvature, (X-value at that point) and a best fit line from the trend where values are straight to get intercept, After getting intercept I would like to use intercept and slop to draw another model on same graph. please see the attached figure for detailed idea.
Guide me please Thank you
  댓글 수: 4
Chad Greene
Chad Greene 2014년 6월 9일
He means the attachment must have become detached.
amberly hadden
amberly hadden 2014년 6월 10일
Alright, here are details.
I'm interested to get a plot of X-Y, then I want to draw a curve which passes through the data set a smooth curve. Then at maximum curvature or at point where the curve is changing the trend want value of x- at that point and then want to draw a straight line which passes through the maximum data (best fit) to get the intercept and slop. Now i would like to plot another daata set on same plot....
Hopefully now you have got my idea.
Thanks jay

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

채택된 답변

Chad Greene
Chad Greene 2014년 6월 9일
Given data at x and y, if you want a ytrend = m(xtrend) + b slope intercept form of the trend line, you can get it by
P = polyfit(x,y,1);
m = P(1);
b = P(2);
Make up some x values for the trend line:
xtrend = min(x):max(x);
Now the trend line is
ytrend = m*xtrend + b;
  댓글 수: 3
Chad Greene
Chad Greene 2014년 6월 10일
The steps above only calculate the trendline. After you've calculated the trend line, try
plot(x,y,'ro'); % plots your original data
hold on; % allows you to plot more data
plot(xtrend,ytrend,'k-') % plots the trend line
amberly hadden
amberly hadden 2014년 6월 11일
Hi Chad,
Thank you. I didt see any curve passing through data or any trend line no slop and intercept.
Please guide lil more
Regards Jay

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

추가 답변 (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