Extraction of values from a graph.

4 次查看(过去 30 天)
I have drawn a graph witha a few known values. I need the values of the intermediate x-values. The code is as below.
T=20:20:300;
rho=[1000 995 985 974 961 945 928 909 889 867 842 815 786 752 714];
plot(T,rho)
From the above plotted graph I need values of T which are not defined.
If there is any other method through which I can extract values(Not necessarily from the graph like linear interpolation), please do tell.
Thank You.

采纳的回答

J. Alex Lee
J. Alex Lee 2019-12-25
There is a function called "interp1", which seems like it will suit your need. You have options on interpolation method.
T=20:20:300;
rho=[1000 995 985 974 961 945 928 909 889 867 842 815 786 752 714];
plot(T,rho,'.-')
% T values of interest
Ti = [25 56 88 204 288]
rhoi = interp1(T,rho,Ti)
hold on;
plot(Ti,rhoi,'*r')
  3 个评论
J. Alex Lee
J. Alex Lee 2019-12-25
What do you intend with this line of code:
Ti=20:1000:300;
Uncomment to see the result. You are asking just for the number 20.
If you want 1000 points between 20 and 300 spaced evenly, then do
Ti = linspace(20,300,1000);
Lepakshi Ramkiran
Lepakshi Ramkiran 2019-12-25
yea my bad sorry, got confused.
Thanks. got it.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Discrete Data Plots 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by