- Forums
- Mathematics
- MATLAB, Maple, Mathematica, LaTeX
- MATLAB
- Thread starterRandomGuy88
- Start date
- Tags
- 3dMatlabVectors
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
NateD
- 647
- 0
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.
Related to How to Superimpose 3D Vectors and Geometry in MATLAB?
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
MATLABClosed form not the same as the discrete form
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 1
- Views
- 1K
MATLABAnimating Vector Addition in Matlab (Looking for improvements)
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 4
- Views
- 867
MATLABHow to plot an orbit around the Earth in MATLAB
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 2
- Views
- 2K
MATLABMATLAB: Fluid Flow - Curl of a Vector Field
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 2
- Views
- 1K
MATLABHow do I write this chua oscillator to an audio file in matlab?
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 5
- Views
- 1K
MATLABHow to add normal vectors/quivers to sphere in matlab?
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 1
- Views
- 2K
MATLABQuestion about how solve 2 body problem in orbit using MATLAB ode45
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 6
- Views
- 2K
MATLABDivergence of a vector field in MATLAB
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 16
- Views
- 5K
MATLABHow can I plot a separable function in 3D using polar coordinates?
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 6
- Views
- 2K
MATLABHow to Plot a 3D Minimization Function in MATLAB?
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 1
- Views
- 1K
- Forums
- Mathematics
- MATLAB, Maple, Mathematica, LaTeX