how to obtain data from plots

2 vues (au cours des 30 derniers jours)
Agastya
Agastya le 28 Mar 2015
Commenté : Star Strider le 28 Mar 2015
I want to get data from the plot(a,b), if i only know three points in 'a' and three points in 'b'
for an example a=[52 104 157] and b=[0.1 0.4 0.4 ] and i want to know the values of remaining points (e.g value of 'b' for 'a'= 60 etc.)
I want to get all the data points in between in a new file.
please help me with any ideas
Regards Agassi

Réponse acceptée

Star Strider
Star Strider le 28 Mar 2015
Use the interp1 function to do the interpolation:
a=[52 104 157];
b=[0.1 0.4 0.4 ];
b60 = interp1(a, b, 60)
produces:
b60 =
0.146153846153846
  2 commentaires
Agastya
Agastya le 28 Mar 2015
Thank u for early reply, can u please let me know how to get all the possible values of a and b other than those three values
Star Strider
Star Strider le 28 Mar 2015
My pleasure!
Use a vector of values in interp1 rather than a single value.
Since ‘all possible points’ is infinite, I will illustrate a finite version instead:
aq = linspace(min(a), max(a), 10)'; % Query Vector For ‘a’
bq = interp1(a, b, aq) % Interpolated Values At ‘aq’
produces:
bq =
100.0000e-003
167.3077e-003
234.6154e-003
301.9231e-003
369.2308e-003
400.0000e-003
400.0000e-003
400.0000e-003
400.0000e-003
400.0000e-003

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

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

Community Treasure Hunt

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

Start Hunting!

Translated by