We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c202749 + f03be99 commit 92f2328Copy full SHA for 92f2328
examples/pylab_examples/psd_demo.py
@@ -1,23 +1,22 @@
1
-#!/usr/bin/env python
2
-# python
3
-
4
-from pylab import *
+import matplotlib.pyplot as plt
+import numpy as np
5
6
dt = 0.01
7
-t = arange(0, 10, dt)
8
-nse = randn(len(t))
9
-r = exp(-t/0.05)
+t = np.arange(0, 10, dt)
+nse = np.random.randn(len(t))
+r = np.exp(-t/0.05)
10
11
-cnse = convolve(nse, r)*dt
+cnse = np.convolve(nse, r)*dt
12
cnse = cnse[:len(t)]
13
-s = 0.1*sin(2*pi*t) + cnse
+s = 0.1*np.sin(2*np.pi*t) + cnse
14
15
-subplot(211)
16
-plot(t, s)
17
-subplot(212)
18
-psd(s, 512, 1/dt)
+plt.subplot(211)
+plt.plot(t, s)
+plt.subplot(212)
+plt.psd(s, 512, 1/dt)
+
+plt.show()
19
20
-show()
21
"""
22
% compare with MATLAB
23
dt = 0.01;
0 commit comments