Thanks to visit codestin.com Credit goes to github.com
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.
1 parent 382b319 commit be8e253Copy full SHA for be8e253
1 file changed
examples/pylab_examples/psd_demo3.py
@@ -8,11 +8,13 @@
8
import matplotlib.pyplot as plt
9
import matplotlib.mlab as mlab
10
11
+prng = np.random.RandomState(123456) # to ensure reproducibility
12
+
13
fs = 1000
14
t = np.linspace(0, 0.3, 301)
15
A = np.array([2, 8]).reshape(-1, 1)
16
f = np.array([150, 140]).reshape(-1, 1)
-xn = (A * np.sin(2 * np.pi * f * t)).sum(axis=0) + 5 * np.random.randn(*t.shape)
17
+xn = (A * np.sin(2 * np.pi * f * t)).sum(axis=0) + 5 * prng.randn(*t.shape)
18
19
fig, (ax0, ax1) = plt.subplots(ncols=2)
20
0 commit comments