开发者

How to make a log plot in matlab

开发者 https://www.devze.com 2023-01-11 04:55 出处:网络
Is 开发者_运维问答it possible to make a plot in matlab that does not actually take the logs of the values? I\'m plotting wide ranges of values and when I try to make a log plot of them, those below 1

Is 开发者_运维问答it possible to make a plot in matlab that does not actually take the logs of the values? I'm plotting wide ranges of values and when I try to make a log plot of them, those below 1 become negative. I would just like it to plot the values on a log scale without taking their logs.


Alternatively, set(gca,'XScale','log') if you have your plot already.


Yes, it is possible. Use the loglog command.

The example from the Mathworks website:

x = logspace(-1,2);   % generate a sequence of points equally spaced logarithmically
loglog(x,exp(x),'-s')
grid on

How to make a log plot in matlab

If you do not want both axes to be log scale, use semilogx or semilogy.


So, you want to plot liner data on logarithmic axes? You can exponentiate you values before using the log plot. This way the point p=(10,3) will plot at the x=10 position.

0

精彩评论

暂无评论...
验证码 换一张
取 消