POLAR Instruction |
POLAR( options ) cseries start end modulus argument newstart
Computes polar decomposition of a complex series. A complex number may be decomposed as
\(z = \left| {{\kern 1pt} z{\kern 1pt} } \right|\exp \left( {i\theta } \right), - \pi < \theta < \pi \)
where \(\left| {{\kern 1pt} z{\kern 1pt} } \right|\) is the modulus or absolute value and \(\theta \) is the argument.
Parameters
cseries |
source complex series |
start, end |
range to transform, by default range of cseries |
modulus |
series for modulus (absolute value). By default, overwrite cseries. Use * if you want to save the argument but not the modulus. |
argument |
series for the argument (angle). |
newstart |
start for modulus and argument. By default start |
Options
PERIODS/[NOPERIODS]
If you use the PERIODS option, POLAR converts the phase lead (argument) from radians to periods. At frequency \(\nu\), a phase lead of \(\theta\) is equivalent to a lead of \(\theta / \nu\) periods. This conversion is meaningful only for frequencies 0 to \(\pi\).
Notes
For individual complex numbers, you can get the polar decomposition using the functions %CABS(z) and %ARG(z). These are real-valued functions which return the modulus and the argument of the complex number z.
If you try to do the polar decomposition of an unsmoothed cross periodogram, you will find that you get a coherence of 1.0, as, in effect, you are estimating a separate relationship at each frequency. Make sure that you smooth everything first.
Example
POLAR can compute coherences and phase leads for cross-spectral analysis. In the following example, series 6, 7 and 8 are the two spectral densities and the cross-spectral density of a pair of series. POLAR sets 9 as the series of coherences and 10 as the phase leads. The phase leads are converted to periods. These two series are then sent back to the time domain and graphed using SCATTER with a “production-quality” setup, using x-axis labels showing fractions of \(\pi\), and separate scales for each. The coherence is forced onto a scale of 0.0 to 1.0.
fft 1
fft 2
cmult 1 1 / 3
cmult 2 2 / 4
cmult 1 2 / 5
window 3 / 6
window 4 / 7
window 5 / 8
cset 8 = %z(t,8)/%csqrt(%z(t,6)*%z(t,7))
polar(periods) 8 / 9 10
ctor 1 nords/2
# 9 10
# coher phase
set freq 1 nords/2 = 2.0*(t-1)/nords
grparm(font="Symbol") axislabels 14
*
* These are good labels for monthly data. For quarterly data, labeling at
* 0, pi/4, pi/2, 3pi/4 and pi is more sensible.
*
compute [vect[strings]] flab=$
||"0","p/6","p/3","p/2","2p/3","5p/6","p"||
scatter(style=line,vmin=0.0,vmax=1.0,vlabel="Coherence",$
overlay=line,ovlabel="Phase Lead (periods)",$
twoscale,xlabels=flab) 2
# freq coher
# freq phase
Copyright © 2025 Thomas A. Doan