2D wave direction Plot with Arrow

8 次查看(过去 30 天)
Dear All
I am trying to make a plot of 2D wave direction but I am not sure the script whether is it true or not,
Please give me some reference to plot the wave direction
Attached the script, data, and, result

采纳的回答

Sudharsana Iyengar
Sudharsana Iyengar 2021-11-6
编辑:Sudharsana Iyengar 2021-11-8
You can use the in built quiver function which is in Matlab. For instance when you want to plot the wind direction in a given region, you can use quiver function.
What quiver does is, it takes 4 arguments. X,Y is the postions and then U and V which are the x and y component of what ever physical parameter you want to study about. For more details. https://in.mathworks.com/help/matlab/ref/quiver.html
The M map tool box by the https://www.eoas.ubc.ca/~rich/map.html contains there own scripts which will add the maps to the plot.
I hope this helps. I dont have M map tool box. I just used Matlab's quiver function to get this figure attached below.
load('D.mat')
[lat,lon]=meshgrid(-60:2:0,20:2:134);
u=sind(D/6);
v=cosd((D)/6);
%m_proj('oblique','lat',[12 -60],'lon',[60 160],'aspect',.8);
%m_coast('patch',[.9 .9 .9],'edgecolor','none');
%m_grid('tickdir','out','yaxislocation','right',...
%'xaxislocation','top','xlabeldir','end','ticklen',.02);
hold on;
quiver(lon,lat,u,v); % note I have used quiver function.
xlabel('wave direction');

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Vector Fields 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by