From 5ace1c62fa014c64f25d2df46647c545c0cbb8ef Mon Sep 17 00:00:00 2001 From: LexvanGastel <l.vangastel@studen.utwente.nl> Date: Tue, 1 Apr 2025 15:46:49 +0200 Subject: [PATCH] vraag10 goede grafie --- main.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/main.py b/main.py index e5d9342..7f8caf8 100644 --- a/main.py +++ b/main.py @@ -77,14 +77,10 @@ def info_emg_data(file_path): mat_data = scipy.io.loadmat(file_path) emg_data = mat_data['emg_data_walking'] - print("Structuur van emg_data:", emg_data.dtype, emg_data.shape) - print("Beschikbare velden in emg_data:", emg_data.dtype.names) - sampling_rate = emg_data['sampling_rate'][0][0][0] data = emg_data['data'][0][0] data = data.T - print("Shape van data:", data.shape) num_samples = data.shape[1] duration = num_samples / sampling_rate return sampling_rate, data, num_samples, duration @@ -114,15 +110,15 @@ def plot_emg_data(file_path): freq_rf, fft_rf = compute_fft(channel_rectus_femoris[:num_samples], sampling_rate) freq_ta, fft_ta = compute_fft(channel_tibialis_anterior[:num_samples], sampling_rate) - plt.figure(figsize=(10,6)) + plt.figure(figsize=(13,8)) - plt.subplot(2, 1, 1) + plt.subplot(2, 2, 1) plt.plot(time_vector, channel_rectus_femoris) plt.title('EMG Data - Rectus femoris') plt.xlabel('Time [Seconds]') plt.ylabel('Amplitude') - plt.subplot(2, 1, 2) + plt.subplot(2, 2, 2) plt.plot(time_vector, channel_tibialis_anterior) plt.title('EMG Data - Tibialis Anterior') plt.xlabel('Time [seconds]') @@ -130,7 +126,6 @@ def plot_emg_data(file_path): plt.tight_layout() - plt.show() plt.subplot(2, 2, 3) plt.plot(freq_rf, fft_rf) @@ -147,9 +142,6 @@ def plot_emg_data(file_path): plt.tight_layout() plt.show() - print(num_samples) - - file_path = "emg_data_walking.mat" plot_emg_data(file_path) -- GitLab