aboutsummaryrefslogtreecommitdiff
path: root/phasor.m
blob: a75cc0ee9f323769a09175fb29e3b30d4e0b6fa6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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