如何在Matlab中绘制对数图 [英] How to make a log plot in matlab

查看:235
本文介绍了如何在Matlab中绘制对数图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在matlab中绘制实际上不记录值对数的图?我正在绘制各种各样的值,当我尝试对它们进行对数绘制时,低于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.

推荐答案

是的,有可能.使用 loglog命令.

Yes, it is possible. Use the loglog command.

Mathworks网站上的示例:

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.

这篇关于如何在Matlab中绘制对数图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆