INVPSD

Purpose:

Constructs a time series with a PSD that matches the PSD input.

Syntax:

INVPSD(psd, N, rpflag, "method")

psd

-

A series, the input PSD series.

N

-

Optional. An integer, the output time series length.

-2

:

bestpow2(2*(length(psd)-1))

-1

:

2*(length(psd)-1) (default)

N > 0

:

specific length

rpflag

-

Optional. An integer, the phase reconstruction method.

0

:

zero phase

1

:

odd symmetric random phase (default)

"method"

-

Optional. A string, the frequency domain interpolation method.

"linear"

:

linear interpolation

"spline"

:

cubic spline interpolation

"sinc"

:

standard sin(x)/x interpolation (default)

"sinx"

:

FFT based periodic sin(x)/sin interpolation

Returns:

A real time domain series with a PSD identical to the input.

Example:

W1: 1..4

W2: psd(W1)

W3: invpsd(W2)

W4: psd(W3)

 

W1 contains a 4 point linear ramp. The PSD of the series is calculated in W2. A time series with the same PSD as W1 is constructed in W3. The PSD of the constructed time series is displayed in W4. Although the values of W1 and W3 differ, the PSD's of the two series are identical.

 

W2 == {25, 4, 1}

W4 == {25, 4, 1}

 

Since random phase is used to construct W3, the values will change if the formula is re-evaluated even if the input does not change. However, W4 will remain identical to W2 for the same input.

Example:

W1: 1..4

W2: psd(W1)

W3: invpsd(W2, 0)

W4: psd(W3)

 

Same as above except the inverse PSD in W3 is calculated with zero phase and the time series is displayed as an autocorrelation sequence. The series in W2 and W4 are identical.

 

W3 == {1.5858, 2, 4.4142, 2}

 

Since zero phase was used, the values in W3 will remain constant upon re-evaluation for the same input series. Also notice that

 

sum(w1) == sum(w3)

Example:

W1: integ(gnorm(1000, 1/1000))

W2: psd(w1)

W3: invpsd(w2, length(w1))

W4: psd(w3);overp(w2);loglog

 

W1 contains 1000 samples of integrated random noise.

W2 contains the PSD of W1.

W3 returns a time series with the same PSD and length as the original time series in W1.

W4 compares the PSD of the derived time series with the PSD of the original time series.

Remarks:

INVPSD finds a time series for the given PSD by reconstructing the original FFT of the PSD and computing the inverse FFT. Since the PHASE information is not available with the PSD, an infinite number of time series exist with the same PSD.

 

If N differs from the default length of 2*(length(psd)-1), the input PSD is interpolated in the frequency domain to produce a time series of length N. The default "sinc" interpolation method is recommended.

 

If rpflag is 0, a phase of all zeros is used to reconstruct the time series and the result is plotted as an autocorrelation series.

 

If rpflag is 1 (the default), a random, odd symmetric phase is used to reconstruct the time series.

 

INVPSD always returns a real time series.

See Also:

BESTPOW2

DFT

FFT

IFFT

PHASE

POWSPEC

PSD

PWELCH

SPECGRAM

SPECTRUM