MATLAB Quiver-小箭头 [英] MATLAB Quiver - Tiny arrows

查看:835
本文介绍了MATLAB Quiver-小箭头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用MATLAB中的颤动函数绘制x和y速度.

I am trying to plot x and y velocities using quiver function in MATLAB.

我有x,y,u和v数组(具有通常的含义),尺寸为100x100
因此,结果是我的颤动图密密麻麻,除非放大,否则看不到箭头.
有点像这样:颤动不绘制箭头只是很多蓝色的Matlab

I have x,y,u and v arrays(with their usual meanings) with dimension 100x100
So, the result is my quiver plot is dense and I cannot see the arrows unless I zoom in.
Somewhat like this: quiver not drawing arrows just lots of blue, matlab

看看我的情节:

有什么方法可以使颤动图的密度降低(并带有更大的箭头)吗?我打算将x轴范围限制为0-4.但是除此之外呢?

Is there any way to make quiver plot less dense(and with bigger arrows)? I am planning to clip x-axis range to 0-4. But anything apart from that?

出于精度方面的考虑,我无法降低网格的密度.但是,如果要使绘图看起来更好,我愿意忽略一些精细的数据点.

I cannot make my mesh less dense for accuracy concerns. I am, however willing to ignore some fine data points if that's required to make the plot look better.

推荐答案

例如,可以通过绘制(假设数据位于数组中)来绘制减少数量的箭头

You can plot a reduced number of arrows by plotting, for example, (assuming your data are in arrays)

quiver(x(1:2:end,1:2:end),y(1:2:end,1:2:end),u(1:2:end,1:2:end),v(1:2:end,1:2:end))

这里的2表示我们只绘制了四分之一的箭头.当然,只要更改所有2的大小,就可以更改它,以使数组的大小都适当.

where the 2 in this example means we plot only a quarter as many arrows. You can of course change it, as long as you change all of the 2's so that the arrays are all appropriately sized.

如果要更改箭头的长度,有两个选项.首先,可以使用缩放选项scale=2按指定的数量缩放箭头,或者如果要使所有箭头的长度相同,则可以标准化速度.这样做会丢失信息,因为您无法通过查看箭头来比较速度的大小,但是在某些情况下它可能很有用.您可以通过将uv都除以sqrt(u.^2+v.^2)来实现(在要绘制箭头的点处.

If you want to change the length of the arrows there are two options. Firstly, you can use the scale option scale=2 to scale the arrows by the amount specified, or you can normalise the velocities if you want to have all the arrows the same length. You do lose information doing that, because you can't compare the magnitude of the velocity by looking at the arrows, but it may be useful in some situations. You can do this by dividing u and v both by sqrt(u.^2+v.^2) (at the points you wish to plot arrows at.

希望可以很好地帮助您解决所有问题.

Hope that helps and sets everything out nicely.

这篇关于MATLAB Quiver-小箭头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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