matlab - 了解符号函数

标签 matlab plot matlab-figure axes logarithm

我正在尝试了解通常用于在 MATLAB 中绘制数据的 semilogy 函数。

正如 MATLAB 帮助部分中的定义所说:

semilogy(Y) creates a plot using a base 10 logarithmic scale for the y-axis and a linear scale for the x-axis. It plots the columns of Y versus their index if Y contains real numbers.

下面的代码应该产生相同的情节:

y1 = 1:100;
figure
semilogy(y1, 'linewidth', 2);

x2 = 1:100;
y2 = log10(x2);
figure
plot(x2, y2, 'linewidth', 2);

enter image description here

但正如我们所见,各图的 y 轴范围不同。谁能解开我的疑惑?

最佳答案

在第一个中,轴被设置为执行对数并自动漂亮地打印刻度标签和网格。因此,这些数字仍然是它们的绝对值。但它们的标记是根据对数轴的。在第二个中,您只是用线性轴绘制对数函数。尽管看起来相似,但它们不是相同的地 block 。

也许打开网格可以让您更好地了解它。查看两个图中 8 或 80 的位置。

enter image description here

关于matlab - 了解符号函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40798772/

相关文章:

matlab - 对数对数图最佳拟合线的 Y 截距错误

python - 在笛卡尔坐标系中绘制受简单圆形轨道 - 双曲吸引子影响的流场,以极坐标给出 - Python

matlab - 如何显示坐标和使用ginput

r - 用 rChart 标记以上点

matlab - Matlab 图中的希腊字母

MATLAB - 在 gui 中更新绘图?

matlab - 在 Matlab 中提取和存储矩阵

matlab - 将指定索引设置为零

image - Matlab将矩阵保存为具有不同值的图像

matlab - 在Matlab中从声音文件的原始数据绘制语音数据