How to extract data from a plot?

3 vues (au cours des 30 derniers jours)
Hengfeng Wang
Hengfeng Wang le 8 Juil 2015
Modifié(e) : Alex le 8 Juil 2015
I got a velocity plot from the acceleration and duration, shown as above. The code is shown as below.
Filename='cycles_ece'
U=xlsread(Filename, 'Table 1');
a_u=U(1:18,4);
t_u=U(1:18,6);
E=xlsread(Filename, 'Table 2');
a_e=E(1:18,4);
t_e=E(1:18,6);
a=[a_u;a_u;a_u;a_u;a_e];
delt=[t_u;t_u;t_u;t_u;t_e];
v=zeros(size(a));
t=zeros(size(delt));
x=-zeros(size(a))
n=numel(a);
for i=1:n
if i==1
v(i)=a(i).*delt(i);
t(i)=delt(i);
else
v(i)=(v(i-1)+a(i).*delt(i));
t(i)=t(i-1)+delt(i);
end
end
plot(t,v)
grid
xlabel('time s')
ylabel('velocity)
Now I want to get the velocity value of every second, i.e. about 1200 points.
So how could I get those values?
Many thanks.

Réponses (1)

Alex
Alex le 8 Juil 2015
Modifié(e) : Alex le 8 Juil 2015
If you have the handle available, you can access the data using the XData and YData properties.

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by