diff options
| author | Warrick Lo <warrick.s.z.lo@gmail.com> | 2026-02-16 03:08:14 -0800 |
|---|---|---|
| committer | Warrick Lo <warrick.s.z.lo@gmail.com> | 2026-02-16 03:08:14 -0800 |
| commit | 0aeeca161c38124b99c0c75fd16351642705ce6b (patch) | |
| tree | 441721fa768f9b75fe2559d0a4e203c514c76904 /phasor.m | |
Signed-off-by: Warrick Lo <warrick.s.z.lo@gmail.com>
Diffstat (limited to 'phasor.m')
| -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 |