Contouring a mesh and assigning magnitude arrows in Matlab
3 次查看(过去 30 天)
显示 更早的评论
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163305/image.jpeg)
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
0 个评论
采纳的回答
Sara
2014-5-23
编辑:Sara
2014-5-23
use
quiver(x(1:dx:end),y(1:dy:end),u(1:dy:end,1:dx:end),v(1:dy:end,1:dx:end))
where dx and dy are how many elements to skip. In this way, the arrows are spaced out.
10 个评论
Sara
2014-5-23
Tried your code with a delta of 2 instead of 20 and saw that the arrows where showing up in the bottom left corner of the image, i.e. matlab was simply using 1:1:nelem as coordinates not knowing any better.
Note, I added the 0.5 at the end of the quiver command so arrows don't touch. Please, modify that too so that the image will look like what you want.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Vector Fields 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!