Borrar filtros
Borrar filtros

2D wave direction Plot with Arrow

10 visualizaciones (últimos 30 días)
Muhammad Uswah Pawara
Muhammad Uswah Pawara el 6 de Nov. de 2021
Editada: Sudharsana Iyengar el 8 de Nov. de 2021
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

Respuesta aceptada

Sudharsana Iyengar
Sudharsana Iyengar el 6 de Nov. de 2021
Editada: Sudharsana Iyengar el 8 de Nov. de 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');

Más respuestas (0)

Categorías

Más información sobre Vector Fields en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by