From f1a9a85c6138715c3933c957c695d0482b901154 Mon Sep 17 00:00:00 2001 From: Warrick Lo Date: Wed, 11 Feb 2026 07:16:45 -0800 Subject: Finish lab report up to Task 2B Signed-off-by: Warrick Lo --- matlab/phasor.m | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 matlab/phasor.m (limited to 'matlab/phasor.m') diff --git a/matlab/phasor.m b/matlab/phasor.m new file mode 100644 index 0000000..add5f84 --- /dev/null +++ b/matlab/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 \ No newline at end of file -- cgit v1.2.3