Cancan
Cancan

Reputation: 731

How to plot continuous colored vector field in Matlab?

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!

Upvotes: 2

Views: 2973

Answers (1)

Shai
Shai

Reputation: 114926

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.

Upvotes: 4

Related Questions