Jump to content
Jesper Nielsen

How to view wave vectors in Matlab

Recommended Posts

When I look at the waves within a simulation I like to view the wave heights overlain with wave vectors. The magnitude of the vectors is the WVHT output and the direction the WVDIR output (cartesian convention). A neat way to do this is to use the "Expression" property of a fvg_sheetvec object.



% create the control object

fvcObj = fvgraphics;

% visualise the wave heights

sheetObj = fvg_sheet(fvcObj,'mymodel.nc','Variables','WVHT'); 

% create the expression which defines the x-component and then the y-component of your vectors. The x-component must come first

expression{1} = 'WVHT.*cosd(WVDIR)';

expression{2} = 'WVHT.*sind(WVDIR)';

% create the vector object

vecObj = fvg_sheetvec(fvcObj,'mymodel.nc','Expression',expression)

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...