Plotting vectors with arrow head - pvec

Version 7.0 (34.5 KB) by Matevz Lavtar
This function allows you to easily plot a vector with an arrow. You also can change the color, style, thickness of it.


Updated 23 Nov 2021

View License

The function pvec makes a vector with arrow head.
With x and y you determine origin of the vector.
With r you determine the lenght of the vector.
With fi you determine the angle in degrees from x axis in positive direction.
Additionally you can add color, style, thickness and final position of vector line.
Default settings are:
color: 'blue'
linestyle: '-'
thickness: 1
endposition: 0
If you want to plot multiple vectors on the same plot, use command hold on/off after function.
To title the plot use command title under function. More options you can find in the figure under the Insert segment.

Cite As

Matevz Lavtar (2023). Plotting vectors with arrow head - pvec (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2020b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes



Plotting vectors even if they are not in origin.


phasor diagram description added


Legend issue fix


Corrected file


Now is possible to move vector in any point, rotated at any angle.


Power diagrams