How to make a log plot in matlab

前端 未结 3 1830
Happy的楠姐
Happy的楠姐 2021-01-17 17:18

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, th

相关标签:
3条回答
  • 2021-01-17 17:55

    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
    

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

    0 讨论(0)
  • 2021-01-17 18:07

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

    0 讨论(0)
  • 2021-01-17 18:11

    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 讨论(0)
提交回复
热议问题