File: random-seed-for-pdf-doc.patch

package info (click to toggle)
octave-communications 1.2.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,992 kB
  • sloc: cpp: 6,991; perl: 476; makefile: 131; sh: 29
file content (49 lines) | stat: -rw-r--r-- 1,807 bytes parent folder | download | duplicates (2)
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
49
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
Applied-Upstream: https://sourceforge.net/p/octave/communications/ci/a04be1255b3cd5be117d5dbb704fe944b350f1b2/
Last-Update: 2025-02-01

--- 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);