How to plot continuous colored vector field in Mat

2019-07-20 15:45发布

I have 2 matrices A and B, and by quiver(A,B) I can easily plot a vector field. However, does anyone know how to visual vector field in the following way in Matlab?(don't really know the name of this kind of plot)

enter image description here

Thanks for helping me out!

1条回答
\"骚年 ilove
2楼-- · 2019-07-20 16:02

If you are looking for a map of magnitude (velocities), then:

v = sqrt( A.^2 + B.^2 );
figure; imagesc( v ); colormap jet;colorbar; axis image;

Alternatively, if you want results that encode magnitude and direction in HSV color space like this example:

You can find this code useful.

查看更多
登录 后发表回答