Docsity

Expont-Stochastic Process-Codes, Exercises of Stochastic Processes

Toggle sidebar
bg1
% Program name; expont.m
% Sampling from Exponential Function
% random numbers from rand function
% in interval [0, 1]
N = 10000;
Max_bins = 50;
rand('state', 0) % initialize the generator to state zero
for k = 1:N
z(k) = 0.; w(k) = 0.;
x = rand;
tx = log(x);
z(k) = -5.0*tx;
w(k) = -1.0*tx;
end
n = hist(z,Max_bins);
m = hist(w,Max_bins);
subplot(2,1,1); bar(n, 'r')
subplot(2,1,2); bar(m, 'b')
% subplot(2,1,1); plot(z)
% subplot(2,1,2); plot(w)
docsity.com

Partial preview of the text

Download Expont-Stochastic Process-Codes and more Exercises Stochastic Processes in PDF only on Docsity!

% Program name; expont.m % Sampling from Exponential Function % random numbers from rand function % in interval [0, 1] N = 10000; Max_bins = 50; rand('state', 0) % initialize the generator to state zero for k = 1:N z(k) = 0.; w(k) = 0.; x = rand; tx = log(x); z(k) = -5.0tx; w(k) = -1.0tx; end n = hist(z,Max_bins); m = hist(w,Max_bins); subplot(2,1,1); bar(n, 'r') subplot(2,1,2); bar(m, 'b') % subplot(2,1,1); plot(z) % subplot(2,1,2); plot(w)

docsity.com