3D vectors in matlab questions

In summary, to plot the 3D vectors of the velocity on the same plot as the geometry of the wing, use the hold on function to superimpose the plots. To indicate the magnitude of a vector in a quiver3 plot, use the 'ColorData' property and the Colorbar function or label specific vectors with their magnitude.
  • #1
RandomGuy88
406
6
I am calculating the velocity of the air in front of a wing. I would like to plot the 3D vectors of the velocity on the same plot as the geometry of the wing. I have the two plots separately but I was wondering if there was anyway I could superimpose one on the other? Currently the geometry is plotted using fill3(X,Y,Z,'w') and the velocity vectors are plotted using quiver3(x,y,z,u,v,w).

I was also wondering it it were possible to indicate the magnitude of a vector other than the relative size of the arrow when using quiver3. Is there a way that I can give different arrows different colors and a color bar to represent the magnitudes or perhaps pick a few of the arrows and label them with their magnitude?
 
Physics news on Phys.org
  • #2
Yes, it is possible to superimpose the two plots. You can use the MATLAB function hold on to allow both plots to appear in the same figure.To indicate the magnitude of a vector in a quiver3 plot, you can use the 'ColorData' property. This allows you to specify a color for each vector based on its magnitude. You can then use the Colorbar function to display a colorbar to represent the magnitude of the vectors. Alternatively, you can pick a few of the arrows and label them with their magnitude.
 

1. What are 3D vectors in Matlab?

3D vectors in Matlab refer to a data structure used to represent a quantity that has both magnitude and direction in a three-dimensional space. They are commonly used in math and physics to describe displacement, velocity, and acceleration.

2. How do I create a 3D vector in Matlab?

To create a 3D vector in Matlab, you can use the vector function with three input arguments representing the x, y, and z components of the vector. For example, v = vector(2, 3, 4) will create a vector with components (2, 3, 4).

3. How do I perform operations on 3D vectors in Matlab?

Matlab has built-in functions for performing various operations on 3D vectors, such as addition, subtraction, cross product, dot product, and normalization. These functions include plus, minus, cross, dot, and norm, respectively.

4. Can I plot 3D vectors in Matlab?

Yes, Matlab has a quiver3 function that allows you to plot 3D vectors as arrows. This function takes in the coordinates of the starting point and the direction and magnitude of the vector, and plots it in a 3D coordinate system.

5. Are there any useful built-in functions for working with 3D vectors in Matlab?

Aside from the operations mentioned earlier, Matlab also has functions such as angle for calculating the angle between two vectors, proj for finding the projection of one vector onto another, and angle2dcm for converting a rotation angle and axis into a direction cosine matrix.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
553
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
801
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
985
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
16
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top