Skip to content
Snippets Groups Projects
Commit bd0ca8d4 authored by LexvanGastel's avatar LexvanGastel
Browse files

vraag 13

parent a5146479
No related branches found
No related tags found
No related merge requests found
......@@ -62,6 +62,14 @@ class SignalProcessing:
b, a = butter(order, [low, high], btype='band')
filtered_data = filtfilt(b, a, data)
return filtered_data
def lowpass_filter(self, data, cutoff):
nyquist = 0.5 * self.fs
normal_cutoff = cutoff / nyquist
order = 4
b, a = butter(order, normal_cutoff, btype='low')
filtered_data = filtfilt(b, a, data)
return filtered_data
def power_spectral_analysis(self, data):
N = len(data)
......@@ -113,21 +121,25 @@ def plot_emg_data(file_path):
filtered_ta = signal_processor.bandpass_filter(channel_tibialis_anterior, 25, 300)
rectified_rf = np.abs(filtered_rf)
recitfied_ta = np.abs(filtered_ta)
rectified_ta = np.abs(filtered_ta)
envelope_rf = signal_processor.lowpass_filter(rectified_rf,5)
envelope_ta = signal_processor.lowpass_filter(rectified_ta,5)
freq_rf, fft_rf = compute_fft(rectified_rf, sampling_rate)
freq_ta, fft_ta = compute_fft(recitfied_ta, sampling_rate)
freq_rf, fft_rf = compute_fft(envelope_rf, sampling_rate)
freq_ta, fft_ta = compute_fft(envelope_ta, sampling_rate)
plt.figure(figsize=(13,8))
plt.subplot(2, 2, 1)
plt.plot(time_vector, filtered_rf)
plt.plot(time_vector, envelope_rf)
plt.title('EMG Data - Rectus femoris')
plt.xlabel('Time [Seconds]')
plt.ylabel('Amplitude')
plt.subplot(2, 2, 2)
plt.plot(time_vector, filtered_ta)
plt.plot(time_vector, envelope_ta)
plt.title('EMG Data - Tibialis Anterior')
plt.xlabel('Time [seconds]')
plt.ylabel('Amplitude')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment