BMEN 3311 Fall 2022 Final Exam - matlab

docx

School

University of North Texas *

*We aren’t endorsed by this school

Course

3311

Subject

Electrical Engineering

Date

Jan 9, 2024

Type

docx

Pages

7

Uploaded by BrigadierDiscovery640

Report
BMEN 3311 Fall 2022 Final Exam – MATLAB Section Student Name: Student ID
Q1. (30 points) An EMG data ( EMG.txt ) was assigned. The sampling frequency is 1000Hz. Use MATLAB to create a subplot of the EMG signal graphed over time, and an amplitude spectrum of the EMG signal. a. What frequency has the largest power? The freq with the lower power is 450hz b. In general, muscle fatigue is concentrated at lower frequencies (<50Hz). Comment on the muscle fatigue by calculating the % of power in 0-50Hz vs. the total frequency power spectrum. (<20% no fatigue; 20-40% mid; >40% high) 2 pi f =2*pi*50 hz = 100 pi W %Final exam mathlab %part 1 EMG = load( 'EMG-1.txt' ); fs=1000; N = length(EMG); f = 1/N; % Sampling rate
T=1/fs; %sampling period t = (0:1:N-1)/fs; %folding frequency Nyquist=1000/2; y1 = abs(fft(EMG)); power = y1(1:N/2+1); Power(2:end-1)=2*Power(2:end-1); F = fs*(0:(N/2))/N; subplot(2,1,2) plot(F,Power) xlabel( 'FREQUENCY' ) xlabel( 'FREQUENCY' ) title( 'Power Spectrum' ) subplot(2,1,1) plot(t,EMG); xlabel( 'signal' ) ylabel( 'Time(s)' ) grid title( 'EMG signal graphed over time' )
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Q3. (30 points) Given an input data sequence the sampling frequency is 8000Hz. (a) Design a 41-tap lowpass FIR filter whose cutoff frequency is 1600Hz using Fourier Transform Hamming Window method. plot the frequency response of the filter. (b) Filter the first 400 data points of x(n), and plot the first 400 samples of the input and output data. %part 2 fs2=8000; n=1:500; x2=1.2*sin(2*pi*1000*n/8000)-1.5*cos(2*pi*2800*n/8000); y2=filter(Num,1,x2); freqz(Num,1,512,8000); figure; subplot(2,1,1); plot (n,x2); xlabel( 'time' ); ylabel( 'amplitude' ); title( 'data' ) subplot(2,1,2); plot(n,y2); xlabel( 'time' ); ylabel( 'amplitude' ); title( 'filterd' );
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Q3. (40 points) A 64-channel EEG data has been given ( EEG_data.mat ). The sampling frequency is 1,000Hz. The EEG data has been contaminated by the eye blinking noise (large spikes). Your task is to use the filtering method and clean the 1st channel of the EEG data. Plot the filter frequency responses, raw data, the filtered data. The score is given by evaluating the code structure, filter design, and the effectiveness of the outcome. fs = 1000 T = 1/fs; N =length(EEG_data-1.mat); ls = size(EEG_data-1.mat); tx =[0:length(EEG_DATA-1.mat)-1]/fs; fx = fs*(0:N/2-1)/N; x= EEGsig; sd = 0.1; normal_noise = sd*randn(1, N); noisy_EEGsig = x + normal_noise; figure(); subplot(4,1,1); grid on ; plot(tx, x); xlabel( 'Time [s]' ); ylabel( 'Amplitude' ); title( 'Original signal' ); subplot(2,1,2); grid on ; plot(tx,normal_noise); xlabel( 'Time [s]' ); ylabel( 'Amplitude' ); title( 'Noise' ); subplot(2,1,1); grid on ; plot(tx, noisy_EEGsig); xlabel( 'Time [s]' ); ylabel( 'Amplitude' ); title( 'Original signal + Noise' ); subplot(4,1,4); buttLoop = filtfilt(d, noisy_EEGsig); plot(t,noisy_EEGsig,t,buttLoop) ylabel( 'Voltage (V)' ) xlabel( 'Time (s)' ) title( 'filtered signal' ) legend( 'Unfiltered' , 'Filtered' ) grid