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');
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.