|
2 | 2 | "cells": [
|
3 | 3 | {
|
4 | 4 | "cell_type": "code",
|
5 |
| - "execution_count": 44, |
| 5 | + "execution_count": 45, |
6 | 6 | "metadata": {},
|
7 | 7 | "outputs": [
|
8 | 8 | {
|
|
51 | 51 | "plt.legend()\n",
|
52 | 52 | "plt.show()\n",
|
53 | 53 | "\n",
|
54 |
| - "# # Apply a High-Pass Filter at 70 Hz\n", |
55 |
| - "# def highpass_filter(signal, cutoff=70, fs=500, order=4):\n", |
56 |
| - "# nyquist = 0.5 * fs # Nyquist frequency\n", |
57 |
| - "# normal_cutoff = cutoff / nyquist # Normalize cutoff frequency\n", |
58 |
| - "# b, a = butter(order, normal_cutoff, btype='high', analog=False)\n", |
59 |
| - "# filtered_signal = filtfilt(b, a, signal)\n", |
60 |
| - "# return filtered_signal\n", |
| 54 | + "# Apply a High-Pass Filter at 70 Hz\n", |
| 55 | + "def highpass_filter(signal, cutoff=70, fs=500, order=4):\n", |
| 56 | + " nyquist = 0.5 * fs # Nyquist frequency\n", |
| 57 | + " normal_cutoff = cutoff / nyquist # Normalize cutoff frequency\n", |
| 58 | + " b, a = butter(order, normal_cutoff, btype='high', analog=False)\n", |
| 59 | + " filtered_signal = filtfilt(b, a, signal)\n", |
| 60 | + " return filtered_signal\n", |
61 | 61 | "\n",
|
62 |
| - "# # Filter the cleaned EMG signal with a high-pass filter\n", |
63 |
| - "# emg_filtered = highpass_filter(emg_signal, cutoff=70, fs=500)\n", |
| 62 | + "# Filter the cleaned EMG signal with a high-pass filter\n", |
| 63 | + "emg_filtered = highpass_filter(emg_signal, cutoff=70, fs=500)\n", |
64 | 64 | "\n",
|
65 | 65 | "# EMG Envelope\n",
|
66 | 66 | "def plot_emg_envelope(emg_signal, fs=500):\n",
|
|
0 commit comments