Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import numpy as np
- import scipy.signal as signal
- def plot_spectrogram(data,NFFT,Fs,ex ):
- plt.specgram(data, NFFT=NFFT, Fs=Fs)
- plt.title("Spectrogram of data")
- plt.ylim(-Fs/2, Fs/2)
- plt.show()
- plt.close()
- if ex:
- exit()
- ### Parameters
- F_offset = 250000
- Fs = 1140000
- ### Generate a digital complex exponential with phase -F_offset/Fs
- fc1 = np.exp(-1.0j*2.0*np.pi* F_offset/Fs*np.arange(len(x1)) )
- plot_spectrogram(fc1, 512, Fs,ex=True)
- plt.plot(20*np.log10(np.abs(np.fft.fft(fc1[:512]*np.hanning(512)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement