from Numeric import arange, sin, exp, pi from pylab import randn, conv, plot, psd, subplot, show # Create signal dt = 0.01 t = arange(0, 10, dt) # Time vector signal = 0.1*sin(2*pi*t) # Create noise noise = conv(randn(len(t)), exp(-t/0.05))*dt noise = noise[:len(t)] # Create noisy signal and plot noisy_signal = signal + noise subplot(211) plot(t, noisy_signal) subplot(212) psd(noisy_signal, 512, 1/dt) show()