gpt4 book ai didi

matlab - 了解符号函数

转载 作者:行者123 更新时间:2023-12-02 08:17:24 25 4
gpt4 key购买 nike

我正在尝试了解通常用于在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com