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

vraag10 goede grafie

parent d0de7d16
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
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