如何在Matlab中调整y轴绘图范围? [英] How to Adjust y axis plot range in Matlab?
问题描述
我需要在matlab中绘制以下函数
I need to plot the following functions in matlab
y1=sign(x)
y2=tanh(x)
y3=(x)/(x+1)
x范围是-5,5,间距为0.1 y-图的范围应该在-1.5到1.5之间.
The x-range is -5,5 with 0.1 spacing The y-plot range should be between -1.5 to 1.5.
每个图应在x和y轴上标记一个标签,并在右下角显示一个图例.
Each plot should have a labeled x and y axis and a legend in the lower right corner.
我唯一不知道的事情是如何调整y绘图范围.香港专业教育学院试图编辑实际的数字,但似乎要做的就是使图形失真. matlab中是否有一个命令可以让我调整y轴的绘制范围?
The only things I cant figure out is how to adjust the y plot range. Ive tried editing the actual figure but all that seems to do is distort the graph. Is there a command within matlab that will let me adjust the y axis plot range?
我还没有想出的另一件事是添加了一个图例,我可以在创建完图后完成,但我想它需要通过matlab命令来完成.
The other thing I havent figured out yet is adding a legend, I can do it after the figure is created but I guess it needs to be done by matlab command.
推荐答案
Yes, use axis
after the plot
command:
axis([-5 5 -1.5 1.5])
这篇关于如何在Matlab中调整y轴绘图范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!