Power spectral density function. There are two forms. |
||
Syntax |
P, F = PSD(Time, Amp) P, F = PSD(Amp, Sample_Rate, Length) |
|
Arguments |
Name |
Description |
Time |
A vector of the timestamps data. Must be in increasing order. |
|
Amp |
A vector of the time domain amplitude data. |
|
Sample_Rate |
The sampling rate (Hz). A positive scalar. |
|
Length (optional) |
The length of the output vectors if specified as a positive integer. If omitted or zero, the length will be the input signal length. If the length is specified as ‘pad’, the length will be rounded up (zero padding the input) if necessary to obtain a power of 2. |
|
Output |
Name |
Description |
P |
A vector of the power spectral density. Its length is equal to that of the input signals unless argument length is specified. |
|
F |
A vector of the evenly spaced frequency points where the power densities are obtained. It has the same length as P. |
|
Example |
Given vectors time and amplitude, a vector is created which is the power spectral density. |
|
Syntax |
||
p = PSD(time, amplitude) |
||
Result |
||
p is a vector of the power spectral density. |
||
Comments |
Time and Amp are assumed to be evenly sampled and must have the same number of elements. The Fast Fourier Transform (FFT) is used to calculate the PSD. The PSD is given by: |FFTMag|^2 / N∆twhere N is the number of points in the Amplitude parameter and ∆t is the sampling interval, the difference between the first two points in parameter Time. |
|
See Also: |