aboutsummaryrefslogtreecommitdiff
path: root/phasor.m
diff options
context:
space:
mode:
authorWarrick Lo <warrick.s.z.lo@gmail.com>2026-02-16 03:08:14 -0800
committerWarrick Lo <warrick.s.z.lo@gmail.com>2026-02-16 03:08:14 -0800
commit0aeeca161c38124b99c0c75fd16351642705ce6b (patch)
tree441721fa768f9b75fe2559d0a4e203c514c76904 /phasor.m
Add MATLAB code for processing dataHEADmaster
Signed-off-by: Warrick Lo <warrick.s.z.lo@gmail.com>
Diffstat (limited to '')
-rw-r--r--phasor.m15
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