Using scipy.signal.spectrogram for creating spectrogram and matplotlib's pcolormesh for plotting.
I'm working on a project where I'm using a spectrogram to visualize the frequencies of the acceleration from an 3D accelerometer. I've got three spectrograms working for each of the x, y, z accelerations independently.
Spectrogram for each axis: So far so good and looks about right...
The problem
I tried creating a spectrogram of the "whole" movement by instead of just inputting an array of just the x / y or z values, I inputted the length of the vector of each sample like this:
[np.sqrt(pow(d.x, 2) + pow(d.y, 2) + pow(d.z, 2)) for d in data]
From this, I get this spectrogram with the same data as showed above:
This is not what's expected because the frequency of the acceleration that was recorded was around 3-4Hz but this is showing around twice as much. Is it wrong to use the Pythagorean theorem to modify the data like this? What is the correct way of creating a spectrogram of a motion in 3D space?