diff options
Diffstat (limited to '')
| -rw-r--r-- | phasor.m | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/phasor.m b/phasor.m new file mode 100644 index 0000000..a75cc0e --- /dev/null +++ b/phasor.m @@ -0,0 +1,15 @@ +function phasor(modulus, argument) + % Wrapper for quiver() that plots phasor diagrams. + % + % Expects the modulus and argument (in degrees) + % of a complex number. + + r = modulus; + phi = argument * pi / 180; + + % Automatic scaling is disabled. + quiver(0, 0, r*cos(phi), r*sin(phi), 0); + + xlim([-r r]); + ylim([-r r]); +end |