how to get a plot quiver with velocity magnitude

4 次查看(过去 30 天)
How to get a quiver plot with change in color basing on velocity vector magnitude

回答(1 个)

Priyanshu Mishra
Priyanshu Mishra 2019-11-27
Hi Bharathi,
You can use 'color' linespec to change the color of your velocity vectors. For your reference I have written a code. You may take help of it.
[x,y] = meshgrid(0:0.2:2,0:0.2:2);
u = cos(x).*y;
v = sin(x).*y;
figure
quiver(x,y,u,v,'color',[1 0 0])
The above code will give you red color velocity vectors. By changing the linespec for eg. [1 1 0], it will give you yellow color.
  1 个评论
Daniele Morandi
Daniele Morandi 2022-11-25
Hi Priyanshu,
I guess that Bharathi meant that color could change depending on velocity magnitude, similarly to what happen in contour plot.
Colorbar should help reading magnitude related to color, if this is possible

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Vector Fields 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by