how to obtain data from plots

4 views (last 30 days)
Agastya
Agastya on 28 Mar 2015
Commented: Star Strider on 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

Accepted Answer

Star Strider
Star Strider on 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 Comments
Agastya
Agastya on 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 on 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

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!