The coordination of EEG rhythms between brain areas can be detected by using Coherence analysis. Is a method developed on the base of classic coherence analysis and signals joint time-frequency representations in recent years. It was used to extract transient characteristics of interactions among brain areas. Describes the temporal, spatial and frequency relationships of brain activities. In this analysis discuss the frequency-varying coherence of EEG (Electroencephalogram) to examine the coordination mechanism of the brain. The power spectral density (PSD) (Welch method) is the frequency-varying method to examine the coordination mechanism of brain areas

**Power spectral densit**y

Power spectral density (PSD) is the frequency response of a random or periodic signal. It describes to us where the average power is distributed as a function of frequency. Indicates which frequencies variations are strong and at which frequencies variations are weak. The unit of PSD is energy per frequency, can obtain energy within a particular frequency range by integrating PSD with that frequency range. The power of a signal in each frequency band can calculate by integrating over positive and negative frequencies. The description of power spectral density generalizes in a straight manner to finite time series with 1 <= n <= N, such as signal sampled at discrete times xn = x(nΔt) for a total measurement period T= NΔt.

The above equation, gives the equation for both methods. In a real-world application, one would typically average the single-measurement PSD on several repetitions of the measurement to obtain a more accurate estimate of theoretical PSD of the physical process underlying the proper measures.

### **Welch Method**

The power spectral density (PSD) of the input signal vector using Welch’s averaged modified method of spectral estimation. The power spectral density is calculated in units of power per radians per sample.

### **Coherence Estimation**

The coherence analysis is a kind of study based on spectrum analysis, which can describe the synchronization of electric brain activities of different frequencies between brain areas [1]. But the nonstationary of EEG data made the classic coherence analysis not able to explore the dynamical properties of the brain rhythms. Hence, from classic coherence analysis and signals time-frequency representations, time-varying coherence methods had been developed and applied to certain cognitive tasks or pathology and healing researches.

The coherence analysis is based on the power spectrum estimation. The coherence between two signals x(t) and y(t) is a real-valued function that is defined as, magnitude squared value of the cross-power spectrum divided by the product of power of the spectra of both signals are completely correlated. The bellow equation is an equitation for analysis of coherence of EEG signals.

### **Coherent / Non-coherent**

When the phase difference and amplitude ratio between two signals remain unchanged; the coefficient equals one, it means that two signals are more coherent, otherwise to zero, the two signals are non-coherent.

When two areas of the brain are more synchronous to each other the result is nearer to 1 that is, they are more coherent to each other, otherwise non-coherent means closer to 0 [1]. As we said in chapter 2 before a seizure (preictal period) occur appears some prodromal symptoms which reflected in the coherence. During the seizure, observed hyper- synchronization in contrast with the preictal period which appears a progressive decrease in synchrony between the EEG channels from the epileptogenic focus and the channels from surrounding areas. The epileptic neurons located in the epileptogenic zone, as they lose their large-scale connections to brain dynamics during the preictal period, and as they may lose the inhibitory control from surrounding areas, become idle and can be recruited to build the seizure.

## **Main Program**

```
[Coherence_RTL, Coherence_RPL, Coherence_Midle,
Coherence_LTL, Coherence_LPL, Coherence_PL ] = Coherence (RightTemporalLobe, RightParasagittalLobe,
Midle, LeftTemporalLobe,
LeftParasagittalLobe, PenetratingLine);
figure;
subplot(3,2,1),
bar(Coherence_LTL,'DisplayName','Coherence_LTL'), title('Coherence of Left Temporal Lobe');
subplot(3,2,2),
bar(Coherence_RTL,'DisplayName','Coherence_RTL'), title('Coherence of Right Temporal Lobe');
subplot(3,2,3),
bar(Coherence_LTL,'DisplayName','Coherence_LPL'), title('Coherence of Left Parasagittal Lobe');
subplot(3,2,4),
bar(Coherence_RPL,'DisplayName','Coherence_RPL'), title('Coherence of Right Parasagittal Lobe');
subplot(3,2,5),
bar(Coherence_Midle,'DisplayName','Coherence_Midle'), title('Coherence of Midle');
subplot(3,2,6),
bar(Coherence_PL,'DisplayName','Coherence_PL'), title('Coherence of Penetrate Line');
```

### **Coherence Function**

```
function
[ Coherence_RTL, Coherence_RPL, Coherence_Midle,
Coherence_LTL, Coherence_LPL, Coherence_PL] = Coherence (RightTemporalLobe, RightParasagittalLobe,
Midle, LeftTemporalLobe,
LeftParasagittalLobe, PenetratingLine)
for i = 1 : 4
channel_1 = RightTemporalLobe(:,i);
for j = 1 : 4
channel_2 = RightTemporalLobe(:,j);
pxx2 = pwelch(channel_1,1000,300,600);
MeanValue2 = mean(pxx2);
pxx3 = pwelch(channel_2,1000,300,600);
MeanValue3 = mean(pxx3);
cxs=mscohere (pxx2, pxx3);
Coherence_RTL(i,j) = mean(cxs);
end
end
for i = 1 : 4
channel_1 = RightParasagittalLobe(:,i);
for j = 1 : 4
channel_2 = RightParasagittalLobe(:,j);
pxx2 = pwelch(channel_1,1000,300,600);
MeanValue2 = mean(pxx2);
pxx3 = pwelch(channel_2,1000,300,600);
MeanValue3 = mean(pxx3);
cxs=mscohere (pxx2, pxx3);
Coherence_RPL(i,j) = mean(cxs);
end
end
for i = 1 : 2
channel_1 = Midle(:,i);
for j = 1 : 2
channel_2 = Midle(:,j);
pxx2 = pwelch(channel_1,1000,300,600);
MeanValue2 = mean(pxx2);
pxx3 = pwelch(channel_2,1000,300,600);
MeanValue3 = mean(pxx3);
cxs=mscohere (pxx2, pxx3);
Coherence_Midle(i,j) = mean(cxs);
end
end
for i = 1 : 4
channel_1 = LeftTemporalLobe(:,i);
for j = 1 : 4
channel_2 = LeftTemporalLobe(:,j);
pxx2 = pwelch(channel_1,1000,300,600);
MeanValue2 = mean(pxx2);
pxx3 = pwelch(channel_2,1000,300,600);
MeanValue3 = mean(pxx3);
cxs=mscohere (pxx2, pxx3);
Coherence_LTL(i,j) = mean(cxs);
end
end
for i = 1 : 4
channel_1 = LeftParasagittalLobe(:,i);
for j = 1 : 4
channel_2 = LeftParasagittalLobe(:,j);
pxx2 = pwelch(channel_1,1000,300,600);
MeanValue2 = mean(pxx2);
pxx3 = pwelch(channel_2,1000,300,600);
MeanValue3 = mean(pxx3);
cxs=mscohere (pxx2, pxx3);
Coherence_LPL(i,j) = mean(cxs);
end
end
for i = 1 : 4
channel_1 = PenetratingLine(:,i);
for j = 1 : 4
channel_2 = PenetratingLine(:,j);
pxx2 = pwelch(channel_1,1000,300,600);
MeanValue2 = mean(pxx2);
pxx3 = pwelch(channel_2,1000,300,600);
MeanValue3 = mean(pxx3);
cxs=mscohere (pxx2, pxx3);
Coherence_PL(i,j) = mean(cxs);
end
end
end
```

[1] S. A. Unde and R. Shriram, \Coherence analysis of eeg signal using power spectral density,” in Communication Systems and Network Technologies (CSNT), 2014 Fourth International Conference on, pp. 871{874, IEEE, 2014.
Great post.