필터 지우기
필터 지우기

How can I use the numerical data from the nice line plot Matlab makes from an irregular set?

조회 수: 1 (최근 30일)
I have plotted some 40 data points with Plot(bx,by) where bx is a vector irregularly spaced and by are the corresponding observed data.
Matlab makes a beautiful smooth curve that summarizes the data. I would like to use it to integrate (sum) the values along the curve, rather than use the irregular data themselves.
How can I get access to the regularly spaced points and values that Matlab has generated to plot the curve? If I go into Plot.m I could convert some vectors into global values so that they are accessible after Plot ends, but I can't see just how to to this.
Thanks very much.
Richard

답변 (2개)

bym
bym 2012년 3월 16일
  댓글 수: 2
Richard
Richard 2012년 3월 17일
Thank you. I don't think this works for me with irregular spacing.
Walter Roberson
Walter Roberson 2012년 3월 17일
NumPoints = 100;
smooth_x = linspace(min(bx), max(bx), NumPoints);
smooth_y = interp1(bx, by, smooth_x);
plot(smooth_x, smooth_y);

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


Jan
Jan 2012년 3월 16일
plot does not do any smoothing or beautification of the values. Therefore I'm not sure what you are talking about. plot can draw straight lines between the data points, such that a kind of linear interpolation is shown. But this is not useful for an integration, because this does not increase the accuracy of the result.
  댓글 수: 1
Richard
Richard 2012년 3월 17일
Thank you. I am not wanting an increase in accuracy-- just convenience.
I have used trapz(bx,by)
which does just enough for me.

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

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by