# Brain-Inspired Healthcare Smart System Based on Perception-Action Cycle
## 4 Mathematical Analysis Basis of the Power Spectral Density  
Within the context of the signal processing described above, there are cases in which the analysis in the time domain is not sufficient, therefore it is recommended to study the signal in another domain in which intervals can be classified, for example in the frequency domain. For these cases, Fast Fourier Transform (FFT) is a good option for biosignal analysis. Frequently, the relevant information of a signal has a characteristic wave that is known in a general way, for this anyone can obtain time series containing this information. Then, the study measures the relationships between signals in both time and frequency domain (correlation or cross spectrum) and more complex transforms for feature extraction [14].  
In the case of the analysis of EEG signals, considering the time plotted on the abscissa axis and the voltage on the ordinate axis, FFT transforms a signal from time domain to frequency domain. Basically what is done during this transformation is to examine how much the raw data can be approximated by sine waves consisting of pure frequencies, that is, free of redundancy; the more they fit, the greater their correlation. Since the frequencies of the human brain associated with affective and cognitive activities are in the range of 1-45 Hz, an analysis using the FFT gives a lot of relevant information, for example, if a person is in a concentration state (theta band) or the response of anyone's neuronal activity describes a sleep state (delta band). Equation (1) defines the FFT  
\[F\left(n\right)=\sum_{k=1}^{N}f\left(t\right)e^{-j\frac{2\pi n}{N}\left(k-1 \right)},1\leq n\leq N. \tag{1}\]  
From Equation (1), it is possible to perform power analysis that reflects the intensity with which a certain frequency is manifested in the signal, or to obtain conjecture of what is the predominant frequency band within the signal.  
The biological signals processing often involves the continuous registration for time long-periods of the electrical activity during an event, pathology or functional state that anyone wants to record on the patient. The digital processing and analysis of these records involves a direct compromise between their duration and size and the computational cost. This means that the greater the amount of information to be processed, the greater the resources consumed from the processing systems, leaving aside the possibility of executing the analysis in real time. For this reason it is necessary to truncate the signals in order to have short segments of them, reflecting the change dynamics and preserving the event properties. Thereby, the Power Spectrum Density (PSD) is an alternative to perform an analysis. Equation (2) is the Fourier transform of the autocorrelation function that defines the PSD  
\[PSD\left(f\right)=\sum_{n=0}^{N-1}\Phi\left(n\right)e^{-j2\pi fT}, \tag{2}\]  
where \(\Phi\) is the autocorrelation function (ACF) defined as  
\[\Phi\left(n\right)=\sum_{k=1}^{N}x\left(k\right)x\left(k+n\right). \tag{3}\]  
where \(N\) is the number of data in vector \(x\) with index \(k\) of a brain activity signal.  
Hence, with Equation (2) a power analysis of a patient's EEG signal can be performed using the FFT, and thereby efficiently separated the delta, theta, alpha, beta and gamma frequencies, Figure 5. Before using Equation (2), a Band-stop Filter or Notch Filter is performed, which is characterized by rejecting a certain frequency that is interfering with the sensor, in our case the 60 Hz frequency generated by the power line. That is why the Notch frequency is equal to \(60/(512/2)\) with a bandwidth of 3 dB.