title: How to obtain spectrogram of a 3D accelerometer file in python?
body: <p>Here is my code, But it doesn't work</p>
  
  <p>Load the dataset</p>
  
  <pre><code>dataset = np.loadtxt("filename", delimiter=",")
  X = dataset[:,0:5]
  Y = dataset[:,5]
  </code></pre>
  
  <p>compute spectrogram</p>
  
  <pre><code>N = 1e5
  amp = 2 * np.sqrt(2)
  noise_power = 0.001 * X / 2
  time = np.arange(dataset) / X
  freq = np.linspace(1e3, 2e3, N)
  x = amp * np.sin(2*np.pi*freq*time)
  x += np.random.normal(scale=np.sqrt(noise_power), size=time.shape)
  </code></pre>
  
  <p>Compute and plot the spectrogram.</p>
  
  <pre><code>f, t, Sxx = signal.spectrogram(x, X)
  plt.pcolormesh(t, f, Sxx)
  plt.ylabel('Frequency [Hz]')
  plt.xlabel('Time [sec]')
  plt.show()
  </code></pre>
  
  <p>this is a part of my dataset</p>
  
  <pre><code>33,4.9106E+13,-0.6946377,12.680544,0.50395286
  33,4.91061E+13,5.012288,11.264028,0.95342433
  33,4.91061E+13,4.903325,10.882658,-0.08172209
  33,4.91062E+13,-0.61291564,18.496431,3.0237172
  </code></pre>