trying to convert accelerometer signal into spectrogram instead of raw data i try the following code
import matplotlib.pyplot as plt
from scipy import signal
import numpy as np
sample_rate, samples = np.loadtxt("trainingdataset.txt", delimiter=",", dtype=np.int32)
frequencies, times, spectogram = signal.spectrogram(samples, sample_rate)
plt.imshow(spectogram)
plt.pcolormesh(times, frequencies, spectogram)
plt.ylabel('Frequency [Hz]')
plt.xlabel('Time [sec]')
plt.show()
but it gets me the following error
Traceback (most recent call last):
File "C:/Users/hadeer.elziaat/Desktop/r.py", line 5, in <module>
sample_rate, samples = np.loadtxt("trainingdataset.txt", delimiter=",", dtype=np.int32)
ValueError: too many values to unpack (expected 2)
the dataset text file only contains the accelerometer x-axis with 2947 rows and one column
this is my dataset
150
100
100
100
100