Getting data values from a plot
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi Guys,
I want to get (x,y) values from a plot. Say my plot is made of the following points (1,1) (2,3) (4,4) and (5,9). Is there anyway to get the value of y on this plot when x=2.5.
Thanks NS
댓글 수: 0
채택된 답변
Nathan Greco
2011년 7월 8일
User interpolation
x = [1 2 4 5];
y = [1 3 4 9];
xi = x(1):.01:x(end); %values between x
yi = interp1(x,y,xi);
findyatx = 2.5;
yfound = yi(abs(xi-findyatx)<eps);
댓글 수: 3
Sean de Wolski
2011년 7월 8일
Distinct means no duplicates. Take the mean of any duplicate values. (unique and accumarray will be your friends)
추가 답변 (1개)
Sean de Wolski
2011년 7월 8일
You mean fit a line to it and solve?
Sure, use polyfit and polyval.
doc polyfit
doc polyval
댓글 수: 3
참고 항목
카테고리
Help Center 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!