Power Spectrum Density calculation using blocking. There are two forms (see Syntax). |
||
Syntax |
P,F = BlockPSD(signal, block_size, overlap, sample_rate, length) P,F = BlockPSD(signal, window, overlap, sample_rate, length) |
|
Arguments |
Name |
Description |
signal |
A vector of the time domain amplitude data. |
|
block_size |
The number of elements to be used for each PSD. Must be a positive integer and no longer than the length of signal. |
|
window |
A vector of window weights to apply to the signal. Its length is used as the block size. |
|
overlap |
The number of elements shared between consecutive blocks. Must be a non-negative integer and less than block_size. |
|
sample_rate |
The sampling rate in units of Hertz. Defaults to 1Hz. |
|
length (optional) |
The length of the output vectors if specified as a positive integer. If omitted or zero, the length will be the block size or window length. If the length is specified as ‘pad’, the length will be rounded up 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 block_size or window unless the argument length is specified. |
|
F |
A vector of the evenly spaced frequency points where the power densities are obtained. Has the same length as P. |
Example 1 |
Given a vector amplitude, a vector is created which is the power spectral density using a block size of 256, overlap of 128, and sampling rate of 1KHz. |
|
Syntax |
||
P,F = BlockPSD(amplitude,256,128,1000) |
||
Result |
||
P is a vector of the power spectral density of the pair. F is the vector of evenly spaced frequencies from zero to 500Hz. |
||
Example 2 |
Given a vector amplitude, a vector is created which is the power spectral density using a Hanning window of length 256, an overlap of 128, and a sampling rate of 1KHz. |
|
|
Syntax |
|
|
W = HannWin(1,256) P,F = BlockPSD(amplitude,W,128,1000) |
|
|
Result |
|
|
P is a vector of the power spectral density of the pair. F is the vector of evenly spaced frequencies from zero to 500Hz. |
|
Comments |
The signal is assumed to be evenly sampled. The BlockPSD function is different from a normal PSD in that it introduces blocking. The input vector is subdivided into blocks. A PSD is then performed on each individual block. The results of these PSDs are then averaged to give the final result. When length is set to ‘pad’, the block size is padded with zeros if needed to round it up to power of 2 before performing a PSD on the block. |
|
See Also: |