Contouring a mesh and assigning magnitude arrows in Matlab

房东的猫 提交于 2019-12-08 07:46:57

问题


I want to assign vector to a contourf graph, in order to show the direction and magnitude of wind. For this I am using contourf(A) and quiver(x,y), where as A is a matrix 151x401 and x,y are matrices with the same sizes (151x401) with magnitude and direction respectively.

When I am using large maps i get the position of the arrows but they are to densily placed and that makes the graph look bad.

The final graph has the arrows as desired, but they are to many of them and too close, I would like them to be more scarce and distributed with more gap between them, so as to be able to increase their length and at the same time have the components of the contour map visible.

Can anyone help , any pointers would be helpful


回答1:


i know its been a long time since the question was asked, but i think i found a way to make it work. I attach the code in case someone encounters the same issues

[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 are the corresponding matrices ones want to use



来源:https://stackoverflow.com/questions/23825299/contouring-a-mesh-and-assigning-magnitude-arrows-in-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!