summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Laboissière <rafael@debian.org>2023-05-14 07:13:50 -0300
committerRafael Laboissière <rafael@debian.org>2023-05-14 07:13:50 -0300
commitca003a1a5b7c16af0336c98fe4edfc19a3aa1ae1 (patch)
tree175129f8d94b49d55278da3f93bcd2c0555555a4
parent1bc48314748849de72a498dd36e5a6e4b2df6ee7 (diff)
Add seed for random number generatorsarchive/debian/1.2.6-1
Forwarded: https://savannah.gnu.org/bugs/index.php?48655 Last-Update: 2016-07-28 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. Gbp-Pq: Name random-seed-for-pdf-doc.patch
-rw-r--r--doc/commsimages.m12
1 files changed, 7 insertions, 5 deletions
diff --git a/doc/commsimages.m b/doc/commsimages.m
index 20490fb..406b99d 100644
--- a/doc/commsimages.m
+++ b/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);