Functions > Signal Processing > Spectral Analysis > Spectral Analysis
  
Spectral Analysis
coherence(vx, vy, n, r, [w])—Returns the coherence of vectors vx and vy. The signal vectors are divided into n overlapping intervals with fraction of overlap r. Each data segment is windowed with taper w.
The coherence function measures the linear dependence of one signal on another, and is equal to the squared magnitude of the cross spectrum of two signals divided by both power spectra, and ranges in value from zero to one. Values of 1 for the coherence function tend to indicate that both signals have strong noise-free components in that frequency band, while values of 0 indicate that there is mostly noise in that frequency band.
cspectrum(vx, vy, n, r, [w])—Returns the cross spectrum of vectors vx and vy. The signal vectors are divided into n overlapping intervals with fraction of overlap r. Each data segment is windowed with taper w.
pspectrum(v, n, r, [w])—Returns the power spectrum of v, computed by dividing v into n overlapping segments with overlap fraction r. Each data segment is windowed with taper w.
snr(vx, vy, n, r, [w])—Returns the signal-to-noise ratio for vx and vy. The signal vectors are divided into n overlapping segments with fraction of overlap r. Each data segment is windowed with taper w.
Arguments
v, vy, and vy are complex-valued signal vectors.
n is an integer between 1 and length(vx) representing the subdivisions of the input signals.
r is the fractional overlap between subdivisions, expressed as a number 0 ≤ r < 1.
w (optional) is an integer representing a windowing function index. A rectangular window is used if w is 0 or not specified.
The following table shows values for w and the windows they correspond to:
Value of w
Window
0
current default window
1
rectangular (default)
2
tapered rectangular
3
triangular
4
Hanning
5
Hamming
6
Blackman
7
Nuttall
Additional Information
The above functions return a vector whose length depends on the length of the original vector, the number of desired subdivisions, and the overlap between the subdivision.
The above functions implement Welch's averaged periodogram method to select "important" parts of the data, and are more appropriate than the FFT for long-duration sample trains with short regions of content.
This type of spectral analysis is common in music and speech analysis, and in radar signal analysis, where much of the measured signal is random noise between values of interest (for example, speech and the pauses between words and syllables).