Plot 3d vectors
h=vector3d(X,Y,Z,U,V,W,'Property','Value',...)
Plot 3d vectors (real 3d) from .stl file to specified location and direction.
basically same usage as quiver3. Property/value pairs are passed to patch.
Some additional property/values are available:
h=vector3d(...,'FileName',file) : string arry with name of .stl file (for example 'arrow4.stl').
h=vector3d(...,'Scale',[sx sy sz]) : scales along the x-axis by sx, along the y-axis by sy, and along the z-axis by sz. If scalar, Vectors are scaled uniformly.
h=vector3d(...,'MaxVert',nmax) : Maximum number of vertices per vector. Lower this value if many vectors have to be plotted. Default is 200.
h=vector3d(...,'Lighting','gouraud') : Sets both, edge and face lighting. Default is flat lighting
h=vector3d(...,'Color',rgb) : Sets face and edge color to specified color (indexed or true rgb). When omitted the vector length and current colormap are used.
h=vector3d(...,'ColorMap',cmap) : sets the colormap to cmap for plotting. Minimum (but non-zero) and maximum data are mapped to the interval [0 1].
h=vector3d(...,'LightDirection',[x y z]) : Adds a infinite light to the axes with specified position [x y z]
Example:
[X,Y,Z]=sphere(20);
[U,V,W] = surfnorm(X,Y,Z);
surf(X,Y,Z);
hold on
h=vector3d(X,Y,Z,U,V,W,'FileName','arrow2.stl','Scale',0.25,'Lighting',...
'gouraud','ColorMap','jet','LightDirection',[-1 -1 1])
Cite As
Pirmin Borer (2025). Plot 3d vectors (https://www.mathworks.com/matlabcentral/fileexchange/29490-plot-3d-vectors), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Graphics > 2-D and 3-D Plots > Vector Fields >
- MATLAB > Graphics > Formatting and Annotation > 3-D Scene Control > Lighting, Transparency, and Shading >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |