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

17 次查看(过去 30 天)
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

采纳的回答

Jan
Jan 2013-5-18
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Object Identification 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by