semilogy plot does not have a continuous line going through zero values

20 vues (au cours des 30 derniers jours)
Andrew Alkiviades
Andrew Alkiviades le 18 Mai 2013
Hi I have the following data
x = 1:24 y = [0 0 0 0 2 6 11 15 22 25 27 27 25 20 14 9 4 1 0 0 0 0 0 0]'
I want to use the semilogy plot to only have a log plot on the y axis. However, the line going through the data disappears when y=0. Is there a way to avoid this and show the line going through zero.
thank you

Réponse acceptée

Jan
Jan le 18 Mai 2013
What should appear for the zero? A logarithmic scale has no suitable value for a zero. Try this:
x = 1:24;
y = [0 0 0 0 2 6 11 15 22 25 27 27 25 20 14 9 4 1 0 0 0 0 0 0];
figure;
semilogy(x, y);
figure;
semilogy(x, max(eps, y));
In the second figure, the EPS values appear as 2e-16 (of course). To get a real zero, the scale must be infinitely large.

Plus de réponses (0)

Catégories

En savoir plus sur Printing and Saving dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by