Hi,
I want to plot some point by using stem comand but I recieve error. can any body guide me. point are lev_press and I need to mark them in between rec_start and rec_stop.
error:
Subscript indices must either be real positive integers or logicals.
Error in example (line 87)
stem(x,lev_press(1,r),':diamondr')
data
rec_start = 1.625608000000000e+03;
rec_stop=1.655613000000000e+03;
x = rec_start:1:rec_stop;
lev_press=[1629.599, 1630.297, 1633.178];
for r = lev_press 1:1:3
figure
stem(x,lev_press(1,r),':diamondr')
end

 Respuesta aceptada

Star Strider
Star Strider el 6 de Dic. de 2018

1 voto

Try this:
rec_start = 1.625608000000000e+03;
rec_stop=1.655613000000000e+03;
lev_press=[1629.599, 1630.297, 1633.178];
x = linspace(rec_start, rec_stop, numel(lev_press));
figure
stem(x, lev_press)
grid
ylim([1600 1650]) % Optional (‘Zooms’ Plot)
The ylim call makes the slight variation in the ‘lev_press’ values more visible.

6 comentarios

Muhammad Haziq
Muhammad Haziq el 6 de Dic. de 2018
Editada: Muhammad Haziq el 6 de Dic. de 2018
Thanks to both for the reply. I ploted the fig but have some error like it is not ploting correct point. like point should be on 1629, 1630, 1633 instead of that
1625, 1640and 1655 what should I do?
I want to plot lev_press values between the x range.
Star Strider
Star Strider el 6 de Dic. de 2018
Try this:
lev_press=[1629.599, 1630.297, 1633.178];
x = floor(linspace(rec_start, rec_stop, numel(lev_press)));
figure
stem(x, lev_press)
grid
xlim([1620 1660])
ylim([1600 1650]) % Optional (‘Zooms’ Plot)
Star Strider
Star Strider el 6 de Dic. de 2018
Muhammad Haziq’s Answer moved here:
It gives the same result, well actually I need to plot some point with respecto to x axis(let say it is time) only, I don't care about the y. so that I can mark rec_start, then I can mark lev_press point and finally I mark rec_stop point.
so can any one guide how to do it
Star Strider
Star Strider el 6 de Dic. de 2018
Please be more specific.
How are ‘rec_start’, ‘rec_stop’, and ‘lev_press’ related? Are they themselves times, or something else?
I have no idea what your data represent, or what you want to do.
I am guessing. Try this:
rec_start = 1.625608000000000e+03;
rec_stop=1.655613000000000e+03;
lev_press=[1629.599, 1630.297, 1633.178];
x = linspace(rec_start, rec_stop, numel(lev_press));
figure
stem(lev_press, ones(size(lev_press)), 'filled')
grid
xlim([rec_start rec_stop])
text(rec_start, 0.05, sprintf('\\bf\\leftarrowStart'), 'HorizontalAlignment','left')
text(rec_stop, 0.05, sprintf('\\bfStop\\rightarrow'), 'HorizontalAlignment','right')
See if that does what you want.
Muhammad Haziq
Muhammad Haziq el 6 de Dic. de 2018
Hi,
Thanks for the reply and helping me, this resolve my problem.
Regards,
Haziq
Star Strider
Star Strider el 6 de Dic. de 2018
As always, my pleasure.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.

Productos

Versión

R2015b

Etiquetas

Preguntada:

el 6 de Dic. de 2018

Comentada:

el 6 de Dic. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by