How to extract detail data from matlab Plot?

조회 수: 2 (최근 30일)
DARSHAN N KANNUR
DARSHAN N KANNUR 2020년 9월 6일
댓글: DARSHAN N KANNUR 2020년 9월 6일
I have a plot in which there are 118 (x, y) points. Where x is not continuous. But plot has upto 490 datas when plotted. So how to extract all 490 data from the plot. Because if we use dataObjs we get only 118 points again.

채택된 답변

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2020년 9월 6일
If you plot only 118 points you can't get more from the plot. The results are interpolated and probably what you want is a continuous formula to model y as a function of x. If you have a polynomial data, take a look at the polyfit function from matlab. In case you really only want to have more refined values, you just need to interpolate the inbetween results yourself:
x = 1:118;
y = x.^2;
xq = linspace(x(1),x(end),490); % Here is the new points you want to generate
yq = interp1(x,y,xq,'pchip'); % Here is the actually interpolation
figure,plot(x,y,'*'),hold on,plot(xq,yq)
  댓글 수: 3
Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2020년 9월 6일
Just use the code that I gave to you in my answer replacing "x" and "y" by your x and y.
DARSHAN N KANNUR
DARSHAN N KANNUR 2020년 9월 6일
Thank you so much.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by