How does the "quiver" function in Matlab work?

How does the quiver function work? I know it creates vector arrows, but what do the u, v, x and y values ​​mean?

  • Is there a relationship between ux and vy?

  • How is the actual arrow length determined and how does it affect the 4 variables above?

  • Does u, v mean "from" and x, y mean "to", which will create an arrow fire at x, y with a starting location at u, v?

0


source to share


2 answers


x

, y

- horizontal and vertical coordinates of the beginning of each vector.



u

, v

- horizontal and vertical components of each vector. So the length of the vectors will be sqrt(u.^2 + v.^2)

. But there is normalization in u

, v

so the maximum length is a good value to avoid overlapping one vector (or going into the "area") of another vector.

+3


source


I had a similar question and with some advice I was able to match the contours and the quiver I posted the code in the answers ( Contour grid and assigning value arrows in Matlab )

take a look what it can help you as well



[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

      

+1


source







All Articles