random signals. sinusoid of random amplitude num_real=4; simulation_length=1024;...
TRANSCRIPT
Random Signals
Sinusoid of Random Amplitude
NUM_REAL=4;
SIMULATION_LENGTH=1024;
t=0:(1/SIMULATION_LENGTH):(1-1/SIMULATION_LENGTH);
realizations=zeros(NUM_REAL,SIMULATION_LENGTH);
figure(1);
clf;
for n=1:NUM_REAL realizations(n,:)=random('unid',4,1,1)*cos(2*pi*4*t);
subplot(NUM_REAL,1,n);
plot(t,realizations(n,:));
end
subplot(NUM_REAL,1,1);
title('Realizations of Sinusoid of discrete random amplitude (PAM)')
( ) cos(2 4 ) uniform [1,4]X t A t Ap=
Sinusoid of Random Phase
NUM_REAL=4;
SIMULATION_LENGTH=1024;
t=0:(1/SIMULATION_LENGTH):(1-1/SIMULATION_LENGTH);
realizations=zeros(NUM_REAL,SIMULATION_LENGTH);
figure(1);
clf;
for n=1:NUM_REAL realizations(n,:)=cos(2*pi*4*t+random('unif',-pi,pi,1,1));
subplot(NUM_REAL,1,n);
plot(t,realizations(n,:));
end
subplot(NUM_REAL,1,1);
title('Realizations of Sinusoid of cont. random phase')
( ) cos(2 4 ) uniform [ , ]X t tp p p= +Q Q -
Sinusoid of Random Frequency
NUM_REAL=4;
SIMULATION_LENGTH=1024;
t=0:(1/SIMULATION_LENGTH):(1-1/SIMULATION_LENGTH);
realizations=zeros(NUM_REAL,SIMULATION_LENGTH);
figure(1);
clf;
for n=1:NUM_REAL realizations(n,:)=cos(2*pi*random('unid',4,1,1)*t);
subplot(NUM_REAL,1,n);
plot(t,realizations(n,:));
end
subplot(NUM_REAL,1,1);
title('Realizations of Sinusoid of discrete random frequency (FSK)')
( ) cos(2 ) uniform [1,4]X t ft fp=
Sinusoid of Random Amp, Freq, Phase
NUM_REAL=4;
SIMULATION_LENGTH=1024;
t=0:(1/SIMULATION_LENGTH):(1-1/SIMULATION_LENGTH);
realizations=zeros(NUM_REAL,SIMULATION_LENGTH);
figure(1);
clf;
for n=1:NUM_REAL realizations(n,:)=random('unid',4,1,1)*cos(2*pi*random('unid',4,1,1)*t+random('unif',-pi,pi,1,1)); subplot(NUM_REAL,1,n);
plot(t,realizations(n,:));
end
subplot(NUM_REAL,1,1);
title('Realizations of Sinusoid of cont. random amp, freq, phase')
( ) cos(2 ) uniform [1,4] uniform [1,4] uniform [ , ]X t A ft A fp p p= +Q Q -
White Gaussian Random Process
NUM_REAL=4;
SIMULATION_LENGTH=1024;
t=0:(1/SIMULATION_LENGTH):(1-1/SIMULATION_LENGTH);
realizations=zeros(NUM_REAL,SIMULATION_LENGTH);
figure(1);
clf;
for n=1:NUM_REAL realizations(n,:)=randn(1,SIMULATION_LENGTH);
subplot(NUM_REAL,1,n);
plot(t,realizations(n,:));
end
subplot(NUM_REAL,1,1);
title('Realizations of WGN process')
Noisy Random Sinusoid
NUM_REAL=4;
SIMULATION_LENGTH=1024;
t=0:(1/SIMULATION_LENGTH):(1-1/SIMULATION_LENGTH);
realizations=zeros(NUM_REAL,SIMULATION_LENGTH);
figure(1);
clf;
for n=1:NUM_REAL realizations(n,:)=random('unid',4,1,1)*cos(2*pi*random('unid',4,1,1)*t+random('unif',-pi,pi,1,1))+0.1*randn(1,SIMULATION_LENGTH);
subplot(NUM_REAL,1,n);
plot(t,realizations(n,:));
end
subplot(NUM_REAL,1,1);
title('Realizations of noisy random sinusoid')
( ) cos(2 )X t A ft Np= +Q +
Poisson Arrival Process
NUM_REAL=4;
SIMULATION_LENGTH=1024;
t=0:(1/SIMULATION_LENGTH):(1-1/SIMULATION_LENGTH);
realizations=zeros(NUM_REAL,SIMULATION_LENGTH);
lambda=0.01;
figure(1);
clf;
for n=1:NUM_REAL arrivals=random('poiss',lambda,1,SIMULATION_LENGTH); realizations(n,:)=cumsum(arrivals);
subplot(NUM_REAL,1,n);
plot(t,realizations(n,:));
end
subplot(NUM_REAL,1,1);
2 1[ ( )]2 12 1
[ ( )][ ( ) ( ) ] 0,1,2,...
!
kt tt t
P Q t Q t k e kk
ll - --- = = =
Picking a RV from a Random Process
NUM_REAL=10000;
SIMULATION_LENGTH=8;
t=0:(1/SIMULATION_LENGTH):(1-1/SIMULATION_LENGTH);
realizations=zeros(NUM_REAL,SIMULATION_LENGTH);
figure(1);
clf;
for n=1:NUM_REAL realizations(n,:)=randn(1,SIMULATION_LENGTH);
end
x=realizations(:,3);
hist(x,30);
A Gaussian RV of mean 0 and std 1
Autocorrelation
function [Rxall]=Rx_est(X,M)
N=length(X);
Rx=zeros(1,M+1);
for m=1:M+1,
for n=1:N-m+1,
Rx(m)=Rx(m)+X(n)*X(n+m-1);
end;
Rx(m)=Rx(m)/(N-m+1);
end;
for i=1:M,
Rxall(i)=Rx(M+2-i);
end
Rxall(M+1:2*M+1)=Rx(1:M+1);
1
1( ) 0,1,...,
N m
x n n mn
R m X X m MN m
-
+=
= =- å
Autocorrelation of Gaussian Random Process
N=1000;
X=randn(1,N);
M=50;
Rx=Rx_est(X,M);
plot(X)
title('Gaussian Random Process')
pause
plot([-M:M],Rx)
title('Autocorrelation function')
Autocorrelation of Gauss-Markov Random Process
rho=0.95;
X0=0;
N=1000;
Ws=randn(1,N);
X(1)=rho*X0+Ws(1);
for i=2:N,
X(i)=rho*X(i-1)+Ws(i);
end;
M=50;
Rx=Rx_est(X,M);
plot(X)
title('Gauss-Markov Random Process')
pause
plot([-M:M],Rx)
title('Autocorrelation function')
[ ] 0.95 [ 1] [ ], [ ] ~ (0,1)
[0] 0
X n X n w n w n N
X
= - +
=