Effacer les filtres
Effacer les filtres

Getting data values from a plot

1 vue (au cours des 30 derniers jours)
NS
NS le 8 Juil 2011
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

Réponse acceptée

Nathan Greco
Nathan Greco le 8 Juil 2011
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 commentaires
Sean de Wolski
Sean de Wolski le 8 Juil 2011
Distinct means no duplicates. Take the mean of any duplicate values. (unique and accumarray will be your friends)
NS
NS le 8 Juil 2011
Works really well. Thanks Nathan

Connectez-vous pour commenter.

Plus de réponses (1)

Sean de Wolski
Sean de Wolski le 8 Juil 2011
You mean fit a line to it and solve?
Sure, use polyfit and polyval.
doc polyfit
doc polyval
  3 commentaires
Sean de Wolski
Sean de Wolski le 8 Juil 2011
"Best" is a word you could write a PhD thesis on.
NS
NS le 8 Juil 2011
Hehehehhe....Ok..

Connectez-vous pour commenter.

Catégories

En savoir plus sur Scatter Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by