projects/iugonet/tools/statistical_package/coherence_analysis/cross_spectrum/
cross_spec.pro
NAME: 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 USES: FILTER.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. CODE: A. Shinbori, 30/09/2011. MODIFICATIONS: A. Shinbori, 30/10/2011 ACKNOWLEDGEMENT: $LastChangedBy: jimm $ $LastChangedDate: 2014-02-11 10:52:58 -0800 (Tue, 11 Feb 2014) $ $LastChangedRevision: 14325 $ $URL $
Routines
top source cross_spec
result = cross_spec(Y1, Y2, DELTAT=DELTAT, WIDTH=WIDTH, WINDOW=WINDOW, AMPLITUDE=AMPLITUDE, PHASE=PHASE, AUTOSPEC1=AUTOSPEC1, autospec2=autospec2, COHERENCY=COHERENCY, FREQ=FREQ, DOUBLE=DOUBLE)
Parameters
- Y1
- Y2
Keywords
- DELTAT
- WIDTH
- WINDOW
- AMPLITUDE
- PHASE
- AUTOSPEC1
- autospec2
- COHERENCY
- FREQ
- DOUBLE
File attributes
Modification date: | Thu Feb 13 16:43:02 2014 |
Lines: | 38 |