Matlab单对数刻度函数semilogx&y

今天,给各位系统的介绍下 Matlab 中使用 semilogx及semilogy 以对数为单轴刻度绘图的常见方法,主要包括x 轴的对数刻度、y 轴的对数刻度绘图方法。

下面,我们分别讲解下 semilogx及semilogy 的函数语法、实例讲解。当然,首先给出matlab中关于函数semilogx及函数semilogy的帮助文档如下:

>> help semilogx
 semilogx Semi-log scale plot.
    semilogx(...) is the same as PLOT(...), except a
    logarithmic (base 10) scale is used for the X-axis.

>> help semilogy
 semilogy Semi-log scale plot.
    semilogy(...) is the same as PLOT(...), except a
    logarithmic (base 10) scale is used for the Y-axis.

其用法与plot一致,下面我们直接分别以x、y轴为对数刻度轴,给两个绘图实例吧。

x 轴的对数刻度

使用 x 轴的对数刻度和 y 轴的线性刻度创建一个绘图。

x = 0:1000;
y = log(x);

figure
semilogx(x,y)

y 轴的对数刻度

使用 y 轴的对数刻度和 x 轴的线性刻度创建一个绘图。

x = 0:0.1:10;
y = exp(x);

figure
semilogy(x,y)

    © 版权声明
    THE END
    喜欢就支持一下吧
    点赞0 分享
    评论 抢沙发

    请登录后发表评论

      暂无评论内容