Estimates cross Power Spectrum Density using blocking. There are two forms (see Syntax). |
||
Syntax |
P,F = BlockCPSD(signal1, signal2, block_size, overlap, sample_rate, length) P,F = BlockCPSD(signal1, signal2, window, overlap, sample_rate, length) |
|
Arguments |
Name |
Description |
signal1 |
A vector of one of the time domain amplitude data. |
|
signal2 |
A vector of the other time domain amplitude data. Both must be of same length. |
|
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. See Comments. |
|
Output |
Name |
Description |
|
P |
A row vector of the cross power spectral density. Its length is equal to that of block_size or window unless argument length is specified. |
|
F |
A row vector of the evenly spaced frequency points where the power densities are obtained. Has the same length as P. |
Example 1 |
Given two vectors amplitude1 and amplitude2, a vector is created which is the cross power spectral density using a block size of 256, overlap of 128 and sampling rate of 1KHz. |
|
Syntax |
||
P,F = BlockCPSD(amplitude1, amplitude2,256,128,1000) |
||
Result |
||
P is a vector of the cross power spectral density of the pair. F is the vector of evenly spaced frequencies from zero to 500Hz. |
||
Example 2 |
Given two vectors amplitude1 and amplitude2, a vector is created which is the power spectral density using a Hanning window of length 256, overlap of 128 and sampling rate of 1KHz. |
|
|
Syntax |
|
|
W = HannWin(256) P,F = BlockCPSD(amplitude1,amplitude2,W,128,1000) |
|
|
ResultP is a vector of the cross 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 BlockCPSD function is different from a normal CPSD in that it introduces blocking. The input vector is subdivided into blocks. A CPSD is then performed on each individual block. The results of these CPSDs 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 the power of 2 before performing a CPSD on the block. |
|
See Also: |