SIDDAGANGA INSTITUTE OF TECHNOLOGY,
TUMAKURU-572103
(An Autonomous Institute under Visvesvaraya Technological University, Belagavi)
BMSP ABL-2 REPORT
Project Title: EMG Signal Rectification and Smoothing
Submitted in fulfillment of the requirements of Bachelor of
Electronics and Telecommunication
Submitted By:
Dhanush Yadav G R (1SI23ET404)
Mujahid Pasha T M (1SI23ET410)
Praveen Kumar (1SI23ET413)
Shamanth R (1SI23ET417)
Under the Guidance of:
Dr. Chandrashekar H M
(Assistant Professor, Department of ETE SIT, Tumakuru-03)
Academic Year 2024-25
Objective:
This project uses MATLAB to process simulated electromyography (EMG) data. It applies
filtering, rectification, and smoothing techniques to reveal muscle activation envelopes.
Introduction:
Electromyography (EMG) signals, which capture the electrical artifacts of our muscles, are
super important for figuring out how our nerves and muscles work together. But here's the
catch: raw EMG data is usually a messy mix of actual muscle activity and unwanted noise,
making it really hard to understand. This project shows how we can use basic digital signal
processing methods in MATLAB to clean up that noisy EMG and turn it into a clear,
understandable picture of muscle activation.
Code and Simulation:
Fs = 1000;
T = 5;
t = 0:1/Fs:T-1/Fs;
emg_activity_burst = [zeros(1, 1.5*Fs), ...
0.5 * sin(2*pi*50*t(1.5*Fs+1:2.5*Fs)) .*
exp(-5*t(1.5*Fs+1:2.5*Fs)), ...
1.0 * sin(2*pi*80*t(2.5*Fs+1:3.5*Fs)) .* (1
- exp(-10*(t(2.5*Fs+1:3.5*Fs)-t(2.5*Fs+1)))), ...
0.3 * randn(1, 1.5*Fs)];
emg_activity_burst = emg_activity_burst(1:length(t));
noise_hf = 0.1 * randn(size(t));
noise_powerline = 0.2 * sin(2*pi*50*t);
raw_emg = emg_activity_burst + noise_hf + noise_powerline;
baseline_wander = 0.05 * sin(2*pi*0.5*t);
raw_emg = raw_emg + baseline_wander;
%Band-pass Filtering and Notch Filtering
f_highpass = 20;
f_lowpass = 450;
filter_order = 4;
[b_bandpass, a_bandpass] = butter(filter_order,
[f_highpass/(Fs/2), f_lowpass/(Fs/2)], 'bandpass');
filtered_emg = filtfilt(b_bandpass, a_bandpass, raw_emg);
f_notch = 50;
bandwidth_notch = 2;
[b_notch, a_notch] = iirnotch(f_notch/(Fs/2),
bandwidth_notch/(Fs/2));
filtered_emg = filtfilt(b_notch, a_notch, filtered_emg);
%% Rectification (Full-wave)
rectified_emg = abs(filtered_emg);
% Smoothing (Linear Envelope Extraction)
smoothing_cutoff_freq = 6;
[b_envelope, a_envelope] = butter(filter_order,
smoothing_cutoff_freq/(Fs/2), 'low');
emg_envelope_lp = filtfilt(b_envelope, a_envelope, rectified_emg);
L = length(filtered_emg);
NFFT = 2^nextpow2(L);
Y = fft(filtered_emg, NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
figure;
subplot(6,1,1);
plot(t, raw_emg);
title('1. Raw EMG Signal');
xlabel('Time (s)');
ylabel('Amplitude (V)');
grid on;
subplot(6,1,2);
plot(t, filtered_emg);
title(['2. Band-pass (', num2str(f_highpass), '-',
num2str(f_lowpass), ' Hz) & 50Hz Notch Filtered EMG']);
xlabel('Time (s)');
ylabel('Amplitude (V)');
grid on;
subplot(6,1,3);
plot(f, 2*abs(Y(1:NFFT/2+1)));
title('Frequency Spectrum of Filtered EMG');
xlabel('Frequency (Hz)');
ylabel('|Y(f)|');
xlim([0 Fs/2]);
grid on;
subplot(6,1,4);
plot(t, rectified_emg);
title('3. Full-wave Rectified EMG');
xlabel('Time (s)');
ylabel('Amplitude (V)');
grid on;
subplot(6,1,5);
plot(t, emg_envelope_lp);
title(['4a. EMG Linear Envelope (Low-pass Filtered, Cutoff: ',
num2str(smoothing_cutoff_freq), ' Hz)']);
xlabel('Time (s)');
ylabel('Amplitude (V)');
grid on;
sgtitle('EMG Signal Processing: Rectification and Smoothing');
linkaxes([subplot(6,1,1) subplot(6,1,2) subplot(6,1,4)
subplot(6,1,5) subplot(6,1,6)], 'x');
xlim([0.5 4]);
OUTPUT:
Methodology:
We started by creating a realistic, noisy EMG signal, complete with common issues like
baseline drift, high-pitched static, and that annoying 50 Hz hum from power lines. To clean
it up, we first used a special Butterworth filter to target the good signal (20-450 Hz) and zap
the 50 Hz hum with a notch filter, making sure to avoid any phase distortion. Finally, we
"straightened out" the signal through full-wave rectification and smoothed it out using two
methods: a low-pass filter and a 100ms RMS envelope, showing how each step transformed
the data.
Conclusion:
This project clearly showed how to turn messy EMG signals into neat, easy-to-understand
muscle activation envelopes. Our digital filtering techniques were key, effectively getting
rid of noise and revealing the true muscle activity underneath. By comparing the low-pass
and RMS envelope methods, we now have a solid grasp of two great ways to measure muscle
activation, setting a strong foundation for future biomedical signal analysis.