Figure 1.3:

Output of a stochastic system versus time.

Code for Figure 1.3

Text of the GNU GPL.

main.m


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
% Example noisy dataset.
a = 1;
c = 1;
r = 1;
q = 1;

x0 = 1;
q0 = 1;

nsim = 201;
x = zeros(1, nsim);
y = zeros(1, nsim);
t = 0:(nsim - 1);
rng(0)
x(1) = x0 + sqrt(q0)*randn();
for i = 1:nsim
    y(i) = c*x(i) + sqrt(r)*randn();
    x(i + 1) = a*x(i) + sqrt(q)*randn();
end

plot(t, y, '-o');

gnuplotsave('noisy.dat', struct('output', [t', y']));