0% found this document useful (0 votes)
2 views3 pages

Stochastic Process Intro

The document describes a computational implementation of a stochastic process using MATLAB, where sample functions are generated based on random variables and a specified power spectral density. It includes code for plotting the stochastic process over a defined time range and discusses the use of autocorrelation for generating the process. The implementation considers parameters such as truncation frequency and the number of summation terms for accuracy.

Uploaded by

Nophi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Stochastic Process Intro

The document describes a computational implementation of a stochastic process using MATLAB, where sample functions are generated based on random variables and a specified power spectral density. It includes code for plotting the stochastic process over a defined time range and discusses the use of autocorrelation for generating the process. The implementation considers parameters such as truncation frequency and the number of summation terms for accuracy.

Uploaded by

Nophi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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

You might also like