PLOT THE GRAPH OF VECTOR FUNCTIONS

2 views (last 30 days)
ASHOK VARDHAN
ASHOK VARDHAN on 18 Sep 2019
Answered: Steven Lord on 18 Sep 2019
HOW TO graph the vector functions what is the matlab code to graph the vectoer functions

Answers (2)

Bjorn Gustavsson
Bjorn Gustavsson on 18 Sep 2019
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

Steven Lord
Steven Lord on 18 Sep 2019
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.

Categories

Find more on Specifying Target for Graphics Output in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!