Figure 5.2:

Sampling faster on the last plot in Figure \ref {fig:wiener}; the sample time is decreased to \Delta t = 10^{-9} and the roughness is restored on this time scale.

Code for Figure 5.2

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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
%
% restore the roughness to the finest time scale produced in wiener.m
%
% jbr, 12/6/2009
%

% This m-file loads data file 'wiener_6.dat'.
table = load ('wiener_6.dat');

tdat = table(:,1); wdat = table(:,2);
ndat = length(tdat);

nsam = 1000;
%nsam = 10;
del = 1/nsam;
npts = (ndat-1)*nsam;
D = 1;

% generate unit variance random variables
% then adjust the mean so the cumsum equals
% the difference in consecutive wdat values

randn("seed",-1);

raw2 = sqrt(2*D*del)*randn(nsam-1, ndat-1);
wmean = diff(wdat);
shiftmean = mean(raw2) - wmean'/(nsam-1);
shift2 = raw2 - kron(ones(nsam-1,1), shiftmean);
shiftnoise = [zeros(1, ndat-1); shift2];
wmat = kron(ones(nsam,1), wdat(1:end-1)') + cumsum(shiftnoise);
w = reshape(wmat, npts, 1);
deltat = kron(diff(tdat)', (0:nsam-1)'/(nsam-1));
tmat = kron(tdat(1:end-1)', ones(nsam,1)) +  deltat;
time = reshape(tmat, npts, 1);


% The generated sequence (time, w) should pass through the data
% (tdat,wdat) but display the Wiener process roughness between the data
% points

plot(tdat, wdat, '-o', time, w)

data = struct('rough', [tdat, wdat], 'fine', [time, w]);
gnuplotsave('wexpand.dat', data, '%.15g');

wiener_6.dat


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 4.99995000e-01 -2.27956105e+02
 4.99996000e-01 -2.28387520e+02
 4.99997000e-01 -2.28122186e+02
 4.99998000e-01 -2.27480166e+02
 4.99999000e-01 -2.27677830e+02
 5.00000000e-01 -2.28513313e+02
 5.00001000e-01 -2.29652516e+02
 5.00002000e-01 -2.29832228e+02
 5.00003000e-01 -2.31347661e+02
 5.00004000e-01 -2.33021909e+02
 5.00005000e-01 -2.34294977e+02