Created
August 25, 2010 17:24
-
-
Save even4void/549902 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from pylab import * | |
dt = 0.0005 | |
t = arange(0.0, 20.0, dt) | |
s1 = sin(2*pi*100*t) | |
s2 = 2*sin(2*pi*400*t) | |
# create a transient "chirp" | |
mask = where(logical_and(t>10, t>12), 1.0, 0.0) | |
s2 = s2 * mask | |
# add some noise into the mix | |
nse = 0.01*randn(len(t)) | |
x = s1 + s2 + nse # the signal | |
NFFT = 1024 # the length of the windowing segments | |
Fs = int(1.0/dt) # the sampling frequency | |
Pxx, freqs, bins, im = specgram(x, NFFT=NFFT, Fs=Fs, noverlap=900) | |
colorbar() | |
show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment