Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here is the code Here are the results Modify the Matlab code from Lecture 7 Prac

ID: 2248618 • Letter: H

Question

Here is the code

Here are the results

Modify the Matlab code from Lecture 7 Practice Problem to obtain the frequency domain information using Matlab's fft function instead of the DFT method. Hint: Due to the nature of the complex number form of the DFT implemented by this fft method, the frequency results are mirror-imaged at the Nyquist frequency and therefore you will only want to display half of the frequency domain data. When you are done the results should resemble the EEG frequency domain results plotted in the Practice Problem.

Explanation / Answer

The MATLAB code can be modified as follows

Fs=50;

load eeg_data;

N=length(eeg);

Tt=N/Fs;

f1=1/Tt;

t=(1:N)/Fs;

Z=fft(eeg);

Z1=abs(Z);

phase=angle(Z);

N1=length(Z);

P1 = abs(Z/N1);

P2 = P1(1:N1/2+1);

P2(2:end-1) = 2*P2(2:end-1);

f2 = Fs*(0:(N1/2))/N1;

subplot(2,1,2);plot(f1,P11,'m');title('EEG Signal Transformed into frequency domain');

xlabel('f1 (Hz)');ylabel('|P11(f)|');

subplot(2,1,2);plot(f1,phase,'m');title('Phase Vs Frequency');

xlabel('f1 (Hz)');ylabel('phase');