How to plot continuous colored vector field in Mat

2019-07-20 15:16发布

问题:

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)

Thanks for helping me out!

回答1:

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.