Next: fourier Up: Time Series Macros Help Previous: evalpoly()   Contents


ffplot(G [, Range[, delta_t]] [,timeunit:Unit] [,plotting keywords]),
  G a REAL matrix, Range a real scalar or vector of length 2, REAL
  scalar delta_t > 0, CHARACTER scalar Unit

Keywords: frequency domain, plotting, complex numbers
ffplot(G, Range, delta_t) plots the columns of REAL matrix G considered
as functions of frequency f for values of f specified by Range.

If N = nrows(G), the i-th row of G is associated with frequency (i-1)/N
cycles per delta_t time units, or (i-1)/(N*delta_t) cycles per unit time
so the full range of frequencies in G is assumed between 0 and

When Range is vector(f1, f2), G is plotted for all Fourier frequencies
between f1 and f2, inclusive.

Range = f, where f is a non-zero scalar, is equivalent to Range =

Range = 0 is equivalent to Range = vector(0,.5/delta_t).

You can provide a default value for delta_t by setting variable DELTAT
appropriately.  You can also provide a time unit to be used in
constucting the default x-axis label by setting variable TIMEUNIT.  See

You can use the usual graphic keywords, including 'title', 'xlab',
'ylab', 'xmin', 'xmax', 'ymin', 'ymax', and 'linetype'.

ffplot(G,Range,delta_t,timeunit:Unit), where Unit is a CHARACTER scalar
such as "year", does the same, the default x-axis label will be, say,
"Frequency (cycles/year)".

Unit should be specified consistantly with delta_t.  For example, with
monthly data and delta_t = 1/12, Unit should be "year", while with
delta_t = 1, Unit should be "month".

You can omit delta_t or both Range and delta_t, and provide a default
time unit.

When you omit argument delta_t (ffplot(G, Range)), the default for
delta_t is variable DELTAT if it is a positive scalar and is 1

When you omit both arguments Range and delta_t (ffplot(G), the defaults
for Range and delta_t are vector(0,.5/DELTAT) and DELTAT, when DELTAT
is a positive scalar, and vector(0, .5) and 1 otherwise

Without keyword 'timeunit', the default x-axis label will be
constructed from the value of CHARACTER scalar TIMEUNIT, if it exists
and differs from "".

Macro tsplot() also uses variables DELTAT and TIMEUNIT, as well as
variable START, to construct a default title and x-axis label.  You
can set them once and forget about them.  For example
  Cmd> START <- 1991; DELTAT <- 1/12; TIMEUNIT <- "year"

to ensure that the x-axis label for both frequency and time domain
plots will be informative.

If some or all of Range is outside of the interval (0,.5/delta_t), the
values plotted are the periodic extension (with period N) of each column
of G.  Thus ffplot(G,vector(-.5,.5), 1) is legal and plots the a full
cycle of each column from frequency -.5 to .5, with the values with
frequencies < 0 coming from rows i with i > N/2.

If the columns of G are complex in Hermitian form, ffplot(G, Range) will
produce the same plot as ffplot(hreal(G), Range) as long as the range
specified is contained in the interval (0, .5/DELTAT).  See

See also tsplot().

Gary Oehlert 2003-01-15