Contour grid and value arrow assignment in Matlab

this is the mesh

I want to assign a vector to a contour graphic to show the direction and magnitude of the wind. For this I use contourf(A)

and quiver(x,y)

, where, when A is a 151x401 matrix and x, y are matrices with the same dimensions (151x401) with magnitude and direction respectively.

When I use large maps, I get the position of the arrows, but they have to be tightly spaced, which makes the graph bad. after quiver

The last plot has arrows at will, but they are too close for many of them, I would like them to be more sparse and distributed with a large gap between them in order to be able to increase their length and at the same time the components of the contour map are visible ...

Can anyone help, any pointers would be helpful

+1


source to share


1 answer


I know this has been a long time since the question was asked, but I think I found a way to make it work. I am attaching the code in case someone is facing the same problems

[nx,ny]= size(A) % A is the matrix used as base
xx=1:1:ny; % set the x-axis to be equal to the y
yy=1:1:nx; % set the y-axis to be equal to the x
contourf(xx,yy,A)
hold on, delta = 8; %delta is the distance between arrows)
quiver(xx(1:delta:end),yy(1:delta:end),B(1:delta:end,1:delta:end),C(1:delta:end,1:delta:end),1) % the 1 at the end is the size of the arrows
set(gca,'fontsize',12);, hold off

      



A, B, C - the corresponding matrices you want to use

+2


source







All Articles