Since coherence is a normalized measurement, the cross-power spectrum is divided by the squared root of the product of the spectra of the signals. Magnitude squared coherence (MSC) is frequently used. This is defined as the squared value of the cross-power spectrum divided by the product of the power of the spectra of both signals. Coherence has values between `0' and `1'. A value '0' means that this band is completely uncorrelated, while a value `1' means that, in this frequency, signals are completely correlated.
That a signal is correlated with other not only means that some energy in a frequency is present in both signals but that the frequency present in both signals is phase related. The coherence of white noise tends to `0'. Let us consider some related signals coming from the file signals. The file contains one recording of sleep with different electroencephalographic channels. We are going to calculate the coherence between three pairs of traces. We choose the traces contained in channel 8, 9, 11 and 12, that contain EOG (channels 8 and 9) , EMG of linked legs (11) and ECG (12).
-->//stacksize(20000000) -->//load signals -->x1 = signals(8); // EOG Pos8M1 -->x2 = signals(9); // EOG Pos18M1 -->y1 = signals(11); // EMG linked legs -->y2 = signals(12); // ECGNow we are going to plot the signals with the following code
-->inct = 0.01; -->incf = 1 / (100 * inct) ; -->segment = 1:500; -->tscale = segment * inct; -->xsetech([0,0,1,1/4]) -->plot2d(tscale ,x1(segment)); -->xsetech([0,1/4,1,1/4]) -->plot2d(tscale,x2(segment)); -->xsetech([0,2/4,1,1/4]) -->plot2d(tscale,y1(segment)); -->xsetech([0,3/4,1,1/4]) -->plot2d(tscale,y2(segment));
![]() |
-->psx1 = pspect(50,100,'hn',x1); -->psx2 = pspect(50,100,'hn',x2); -->psx12 = pspect(50,100,'hn',x1,x2); -->psy1 = pspect(50,100,'hn',y1); -->psy2 = pspect(50,100,'hn',y2); -->psy12 = pspect(50,100,'hn',y1,y2); -->psxy = pspect(50,100,'hn',x1,y2); -->cohx = ( (abs(psx12) ^ 2) ./ (psx1 .* psx2) ); -->cohy = ( (abs(psy12) ^ 2) ./ (psy1 .* psy2) ); -->cohxy = ( (abs(psxy) ^ 2) ./ (psx1 .* psy2) );We calculate the spectra and the cross-spectra with `pspect'. In the previous code we calculated the coherence of both EOG channels (`cohx') the coherence of EMG with ECG (`cohy') and the coherence of an EOG channel with ECG (`cohxy'). So we calculated three coherence values. We want to represent these vectors. We are going to represent the values with the spectra of the original signals.
-->frec = [0:49] * incf; -->xsetech([0,0,1/3,1/3]); // first row -->plot2d (frec,20*log10( psx1(1:50))) ; -->xsetech([1/3,0,1/3,1/3]); -->plot2d (frec, cohx(1:50),1,'011',' ', [0,0,50,1] ) ; -->xsetech([2/3,0,1/3,1/3]); -->plot2d (frec,20* log10( psx2(1:50))) ;The previous code plots the coherence of both EOG channels. We can expect a high degree of coherence since they have a common reference and EOG tends to present a wide electric field.
. Now, we are going to represent the coherence of EMG of legs with ECG.
-->xsetech([0,1/3,1/3,1/3]); // second row -->plot2d (frec,20*log10( psy1(1:50))) ; -->xsetech([1/3,1/3,1/3,1/3]); -->plot2d (frec, cohy(1:50),1,'011',' ', [0,0,50,1] ) ; -->xsetech([2/3,1/3,1/3,1/3]); -->plot2d (frec,20* log10( psy2(1:50))) ;Finally we will represent the coherence of an electrooculographic channel with ECG. Notice that coherence is concentrated in the frequencies present in QRS complex.
-->xsetech([0,2/3,1/3,1/3]); // third row -->plot2d (frec,20*log10( psx1(1:50))) ; -->xsetech([1/3,2/3,1/3,1/3]); -->plot2d (frec, cohxy(1:50),1,'011',' ', [0,0,50,1] ) ; -->xsetech([2/3,2/3,1/3,1/3]); -->plot2d (frec,20* log10( psy2(1:50))) ;And here is the result
![]() |