NV5 GEOSPATIAL SOFTWARE
>  Docs Center  >  Libraries  >  Daithi  >  CROSS_SPEC

CROSS_SPEC

CROSS_SPEC

## Purpose

This function estimates the power cross-spectrum of two vectors.

## Category

Time Series Analysis

## Calling Sequence

Result = CROSS_SPEC( Y1, Y2 )

## Inputs

Y1: A floating point vector of the same length as Y2.
Y2: A floating point vector of the same length as Y1.

## Optional Inputs

-
DELTAT, WIDTH, WINDOW

## Keyword Parameters

AMPLITUDE: Returns the amplitude component of the cross-spectrum.
AUTOSPEC1: Returns the auto-spectrum of Y1.
AUTOSPEC2: Returns the auto-spectrum of Y2.
COHERENCY: Returns the coherency of Y1 and Y2.
DELTAT: The time interval between values in the input vectors.
DOUBLE: If set the calculations are performed in double precision
arithmetic. The default is single precision.
FREQ: Returns the frequency values corresponding to the output
cross-spectrum.
PHASE: Returns the phase component of the cross-spectrum, in radians.
Positive values mean that Y1 is leading Y2 at that frequency.
WIDTH: The width, of type integer, of the smoothing window to be used
by FILTER.pro. If not given then no smoothing is performed.
WINDOW: A string containing the name of the smoothing window to be
used by FILTER.pro. Smoothing is only performed if WIDTH is
given.

## Outputs

Result: Returns the cross-spectrum.
AMPLITUDE, AUTOSPEC1, AUTOSPEC2, COHERENCY, FREQ, PHASE

FILTER.pro
IMAG.pro
REAL.pro

## Procedure

This function uses the FFT function to estimate the spectra.

## Example

Create two time series of a periodic signal of period 23 and phase
difference pi/2. Add a pinch of noise.
y1 = sin( 6.28 * findgen( 1000 ) / 23. ) + 0.1 * randomn( 1, 1000 )
y2 = sin( 6.28 * ( findgen( 1000 ) / 23. - 0.25 ) ) \$
+ 0.1 * randomn( 2, 1000 )
Estimate the cross-spectrum.
result = cross_spec( y1, y2, amplitude=amplitude, phase=phase, \$
freq=freq )
The amplitude power spectrum should have a peak at freq=1./23., and
the phase at that frequency should be 0.5.

## Modification History

Written by: Daithi A. Stone (stoned@atm.ox.ac.uk), 2004-07-13.

© 2024 NV5 Geospatial Solutions, Inc. |  Legal