更改MATLAB图的缩放比例 [英] Changing scaling of MATLAB Figure

查看:545
本文介绍了更改MATLAB图的缩放比例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在X轴上显示20,000点的图形.所以 将x轴标记为0 ... 20,000.但是,现在我想扩展 从0到50.但是当我尝试在绘图窗口中执行此操作时, 向我显示了前50分,而不是改变比例.在那儿 在MATLAB中有任何简单的方法可以做到这一点?

I have a figure that displays 20,000 points on the x-axis. So it labels the x-axis from 0 ... 20,000. However, now I would like to scale it from 0 to 50. But when I try to do this in the plot window it just shows me the first 50 points, instead of changing the scale. Is there any straightforward way to do that in MATLAB?

推荐答案

您必须更改绘图中的x值,或者可以更改轴标签.

You have to change the x-values in your plot, or you can change the axis labels.

以下是使用特定x值进行绘图的方式:

Here is how you plot using specific x-values:

%# create some data
data = randn(20000,1);

%# create 20,000 corresponding x-values so that the last one is 50 - works for any number of data points
x = linspace(1,50,length(data));

%# plot
plot(x,data)

编辑 Doresoom 具有方便的功能显示了如何更改轴标签.

EDIT Doresoom has conveniently shown how to change the axis labels.

这篇关于更改MATLAB图的缩放比例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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