MATLAB Answers

0

PLOT THE GRAPH OF VECTOR FUNCTIONS

Asked by ASHOK VARDHAN on 18 Sep 2019 at 4:53
Latest activity Answered by Steven Lord
on 18 Sep 2019 at 13:44
HOW TO graph the vector functions what is the matlab code to graph the vectoer functions

  0 Comments

Sign in to comment.

Tags

2 Answers

Answer by Bjorn Gustavsson on 18 Sep 2019 at 7:46

So you want to plot a vector-function , where f gives you 3-element vectors at points in 3-D space. For that you might get what you need from quiver3.
But in my experience (for what that's worth) such plots rarely gives me as good an illustration of what's going on as
I hope. You might get additional/alternative plots with streamline. Then there are the functions for simpler cases such as compass, feather, rose, and I've liklely forgotten. Also have a look at the file exchange.
Then you could go creative, something like (for case with r in 2-D), you could put the x, y, and z components of your arrays v into the r, g, and b, components of an image and display that as and image:
load wind
U = u(:,:,12);
V = v(:,:,12);
W = w(:,:,12);
RGB(:,:,3) = (W-min(W(:)))/(max(W(:))-min(W(:)));
RGB(:,:,2) = (V-min(V(:)))/(max(V(:))-min(V(:)));
RGB(:,:,1) = (U-min(U(:)))/(max(U(:))-min(U(:)));
imagesc(RGB)
Which gives a result I'd never use, but you might do other combinations, starting with mapping magnitude and directions to HSV/HSI/CLAB spaces - something might stick.
HTH

  0 Comments

Sign in to comment.


Answer by Steven Lord
on 18 Sep 2019 at 13:44

If you have a picture in your mind of how you want the graph to look, open the Plots tab in the Toolstrip and click the triangle to the right side of the Plots section. Scroll through the thumbnails until you see one that looks close to what you want. The name of the function associated with that thumbnail is written below the thumbnail. You can open the documentation for that function to learn more about how to use it.
If you have variables selected in the Workspace component in the MATLAB Desktop when you open the Plots tab, you can limit what's shown to just those plots that can be created with the selected variables (based on the size and shape, I believe.) In that case you can click on the thumbnail to have MATLAB automatically create that plot for the selected data.

  0 Comments

Sign in to comment.