2D wave direction Plot with Arrow

6 views (last 30 days)
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

Accepted Answer

Sudharsana Iyengar
Sudharsana Iyengar on 6 Nov 2021
Edited: Sudharsana Iyengar on 8 Nov 2021
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');

More Answers (0)

Categories

Find more on Vector Fields in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!