summaryrefslogtreecommitdiff
path: root/matlab/phasor.m
blob: add5f846c43ce6264dbed72bdde18ab54ecbfacb (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