Stochastic process
Assume stochastic process
where
clc, clear; rng(11091991)
mu = 0;
dw = 0.1;
K = 10;
figure; set(gcf,'units','inches','position',[1,1,6.5,3])
for ii=1:2 % number of sample functions
sum_Xk = 0;
t = -8*pi:0.1:8*pi;
for k = -K:1:K
wk = dw*(2*k-1)/2;
Vk = randn();
PhiK = rand()*2*pi;
Xk = Vk .* cos(wk.*t + PhiK);
sum_Xk = sum_Xk + Xk;
end
Xt = mu + sum_Xk;
plot(t,Xt); hold on;
end
xlabel('$t$',Interpreter='latex');
ylabel('$X(t)$',Interpreter='latex');
yline(0);
1
Computational implementation
where
is the upper bound for the truncation/cutoff frequency
for symmetrical power density functions
is the number of the summation terms
is power spectral density considering positive frequencies only
clc, clear; rng(11091991); warning off;
function [R] = exp_autocorr(tau)
c = 1;
sigma = 1;
R = sigma^2 * exp( -c.*abs(tau) );
end
mu = 0;
wUB = 0.95;
wLB = -wUB;
m = 10;
dw = (wUB-wLB)/m;
tD = 8*pi;
alpha = 1;
2
sigma = 1;
figure; set(gcf,'units','inches','position',[1,1,6.5,3])
for ii=1:2 % number of sample functions
sum_Xk = 0;
t = -tD:0.1:tD;
for k = -m:1:m
wk = k*dw;
%integrand = @(tau) (1/(2*pi))*exp_autocorr(tau).*exp(-1i*wk*tau);
%S = integral(integrand,-Inf,Inf,'AbsTol',1e-10,'RelTol',1e-8);
S = (2*alpha*sigma^2)/(alpha^2 + wk^2);
Vk = sqrt(2*S*dw);
PhiK = rand()*2*pi;
Xk = Vk .* cos(wk.*t + PhiK);
sum_Xk = sum_Xk + Xk;
end
Xt = mu + sum_Xk;
plot(t,Xt); hold on;
end
xlabel('$t$',Interpreter='latex');
ylabel('$X(t)$',Interpreter='latex');
yline(0);