summaryrefslogtreecommitdiff
path: root/debian/patches/random-seed-for-pdf-doc.patch
blob: 8b016e40a87f7f8214ee35d2bcf795f5dc97f44c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Description: Add seed for random number generators
 This patch add seeds for the random number generators used when
 building the PDF figures of the manual.  This ensures that the data
 appearing in the figures is reproducible.
Author: Rafael Laboissière <rafael@debian.org>
Forwarded: https://savannah.gnu.org/bugs/index.php?48655
Last-Update: 2016-07-28

--- octave-communications-1.2.1.orig/doc/commsimages.m
+++ octave-communications-1.2.1/doc/commsimages.m
@@ -48,10 +48,12 @@ function commsimages (nm, typ)
     d_typ = ["-d", typ];
   endif
 
+  seed = 1234;
+
   if (strcmp (nm, "awgn"))
     x = 0:0.1:2*pi;
     y = sin (x);
-    noisy = awgn (y, 10, "measured");
+    noisy = awgn (y, 10, "measured", [], seed);
     plot (x, y, "r");
     hold on;
     plot (x, noisy, "g--");
@@ -62,9 +64,9 @@ function commsimages (nm, typ)
     ovsp = 50;
     x = 1:n;
     xi = 1:1/ovsp:n-0.1;
-    y = randsrc (1, n, [1 + 1i, 1 - 1i, -1 - 1i, -1 + 1i]);
+    y = randsrc (1, n, [1 + 1i, 1 - 1i, -1 - 1i, -1 + 1i], seed);
     yi = interp1 (x, y, xi);
-    noisy = awgn (yi, 15, "measured");
+    noisy = awgn (yi, 15, "measured", [], seed);
     cf = gcf ();
     set (cf, "tag", "eyediagram");
     eyediagram (noisy, ovsp, [], [], [], cf);
@@ -74,9 +76,9 @@ function commsimages (nm, typ)
     ovsp = 5;
     x = 1:n;
     xi = 1:1/ovsp:n-0.1;
-    y = randsrc (1, n, [1 + 1i, 1 - 1i, -1 - 1i, -1 + 1i]);
+    y = randsrc (1, n, [1 + 1i, 1 - 1i, -1 - 1i, -1 + 1i], seed);
     yi = interp1 (x, y, xi);
-    noisy = awgn (yi, 15, "measured");
+    noisy = awgn (yi, 15, "measured", [], seed);
     cf = gcf ();
     set (cf, "tag", "scatterplot");
     f = scatterplot (noisy, 1, 0, "b", cf);