wtr
Full Member level 5
I've read this, https://www.edaboard.com/threads/arduinofft-h-generates-weird-results.400524/
Posted about my dip in magnitude here https://www.edaboard.com/threads/so...ictim-of-transceiver-agc.400674/#post-1725359.
However now I've stepped back and generated a stimulus. I know that the results I was previously getting is not a symptom of my captured data, but rather the processing.
This generated sinusoidal is then fed into the fft. I change the frequency. Please watch the magnitude. Is specgram broken?
Please run the following python code for yourself and see what happens.
Thanks in advance.
Posted about my dip in magnitude here https://www.edaboard.com/threads/so...ictim-of-transceiver-agc.400674/#post-1725359.
However now I've stepped back and generated a stimulus. I know that the results I was previously getting is not a symptom of my captured data, but rather the processing.
This generated sinusoidal is then fed into the fft. I change the frequency. Please watch the magnitude. Is specgram broken?
Please run the following python code for yourself and see what happens.
Code Python - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 import numpy as np from matplotlib import mlab import matplotlib.pyplot as plt import matplotlib.animation as animation def safe_log10(values, minval=1e-16): # pragma: no cover """Safely do log10.""" return np.log10(values.clip(min=minval)) def animate(i): A = 10 fs = 44100 sample = fs nfft = 4096 f = 11440 + (i * 10) # Steps by # f = 11440 + (i * (fs / nfft)) # Steps by x = np.arange(sample * 10) y = A * np.sin(2 * np.pi * f * x / fs) ax = plt.axes(projection='3d') spec, freqs, t = mlab.specgram(y, NFFT=nfft, noverlap=0, Fs=fs, mode='magnitude') X, Y, Z = t[None, :], freqs[:, None], 20.0 * safe_log10(spec) ax.plot_surface(X, Y, Z, cmap='viridis', cstride=4, rstride=4) ax.set_xlabel('time (s)') ax.set_ylabel('frequencies (Hz)') ax.set_zlabel('amplitude (dB)') ax.set_zlim(-140, 0) animation_1 = animation.FuncAnimation(plt.gcf(), animate, interval=100) plt.show()
Thanks in advance.