Digital Signal Processing Reference
In-Depth Information
1
=
arctan(b=a) = arctan(4=3) = 0:9273 rad
2
=
arctan(b=a) = arctan(4=3) =0:9273 rad
3
=
arctan(b=a) = arctan(4=3) = 0:9273 rad
4
=
arctan(b=a) = arctan(4=3) =0:9273 rad:
Clearly, 2 and 3 are not correct since they lie in the second and third quadrants,
respectively. Therefore, their angles should measure between =2 (1:57) and
(3:14) for 2 and between=2 and for 3 . Adding to 2 and to 3 xes
the problem. 4 is ne, even though the arctan function returns a negative value for
it. Here are the corrected angles:
1
=
arctan(b=a) = arctan(4=3) = 0:9273 rad
2
=
arctan(b=a) + =0:9273 + = 2:2143 rad
3
=
arctan(b=a) = 0:9273 =2:2143 rad
4
=
arctan(b=a) = arctan(4=3) =0:9273 rad:
The function below converts from complex numbers like x + jy to polar coordi-
nates. This is not as ecient as using abs and angle, but it demonstrates how to
implement the equations.
%
% Convert from complex form (x+jy)
% to polar form (magnitude,angle)
%
% usage:
[r, theta] = complex2polar(X)
%
function [mag, phase] = complex2polar(X)
% Find magnitudes
mag = sqrt(real(X).*real(X) + imag(X).*imag(X));
% Find phase angles
% Note that parameters for tan and atan are in radians
Search WWH ::




Custom Search