This document shows how to get the coherence between signals X and Y using MathScript or LabVIEW functions.
LabVIEW's Frequency Response Function (Mag-Phase) computes the frequency response and the coherence based on the input signals. For more information on the mathematics behind this function, see DeveloperZone Tutorial The Fundamentals of FFT-Based Signal Analysis and Measurement in LabVIEW and LabWindows/CVI.
The implementation of MSCohere and Frequency Response Function is different. A common question is, "Why is the coherence returned by the Frequency Response Function (Mag-Phase) always 1?" The answer is suggested by KnowledgeBase 27BF0ABI. This document demonstrates parallel behavior between MSCohere and , and Frequency Response Function (Mag-Phase).
Caveats and Additional Notes
The attached file is built in LabVIEW 8.6.
The MathScript node is used to generate input signals x and y, each signal is 16,384 samples long. MSCohere options are used so that the signals are processed analogously to how the Frequency Response Function (Mag-Phase) processes its inputs. The same x and y signals are passed both to the Frequency Response Function (Mag-Phase) and to Cross Spectrum and to FFT Power Spectrum for a piecewise calculation of the coherence.