line plot of events with value

1 次查看(过去 30 天)
Mech Princess
Mech Princess 2012-10-26
I want to plot TEST values (amplitude) against the given time in TEST_TS. Then I want to plot vertical lines at given times of ttss.
example code is given below
TEST_TS = (1:10)';
TEST = [5 -1 8 10 -4 -2 7 0 -2 1]';
ttts = [2.5 3 9.2 1 8]';
for i=1:10
line([TEST_TS(i) TEST_TS(i)],[TEST(i,1) 0]); hold on
end
yL = get(gca,'YLim');
line([ttts ttts],yL,'Color','r');
Now my issue is that when my data vector is long (200,000 points) it takes forever for the plot to come out. I have several such plots in my code.
If I plot the first using "stem" it gives an error when I try to plot ttss using plot or line.
Does anyone know an efficient way to do this? Thanks

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by