8000 add demo for new spectral plot types · matplotlib/matplotlib@9499793 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9499793

Browse files
committed
add demo for new spectral plot types
1 parent c89ce08 commit 9499793

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env python
2+
# python
3+
4+
from pylab import *
5+
6+
dt = 0.01
7+
Fs = 1/dt
8+
t = arange(0, 10, dt)
9+
nse = randn(len(t))
10+
r = exp(-t/0.05)
11+
12+
cnse = convolve(nse, r)*dt
13+
cnse = cnse[:len(t)]
14+
s = 0.1*sin(2*pi*t) + cnse
15+
16+
subplot(3, 2, 1)
17+
plot(t, s)
18+
19+
subplot(3, 2, 3)
20+
magnitude_spectrum(s, Fs=Fs)
21+
22+
subplot(3, 2, 4)
23+
magnitude_spectrum(s, Fs=Fs, scale='dB')
24+
25+
subplot(3, 2, 5)
26+
angle_spectrum(s, Fs=Fs)
27+
28+
subplot(3, 2, 6)
29+
phase_spectrum(s, Fs=Fs)
30+
31+
show()

0 commit comments

Comments
 (0)
0