x[k] = ax[k - 1] + b[k]
where a is a constant and b[k] is a binary white noise sequence taking on values -1 and +1 with equal probabilities.I set x[-1] = 0. Four values for a were used: 0.95, 0.80, -0.95, and 2. For 50 samples for each, the results are
If removing the random variable, the system is clearly a feedback system with the current value depending on the previous value multiplied by a constant. Without the random variable, the system can be analyzed as the cases below:
- |a| < 1: If the magnitude of the constant a is less than 1, without the random variable and zero-initial conditions, the system should show attenuation in the magnitude of the signal. This case can be further divided into two subcases:
- a > 0: The signal should be strictly decreasing.
- a < 0: The sequence is an alternating sequence with the magnitude of the signal decreasing.
- |a| = 0: The magnitude of the signal remains the same.
- |a| > 0: The magnitude of the signal increases as time goes. As in the case of |a| < 1, this can be further divided into two subcases:
- a > 0: The signal should be strictly increasing.
- a < 0: The sequence is an alternating sequence with the magnitude of the signal increasing as time goes.
With the random variable, however, the magnitude of the signal might be amplified or attenuated by the random variable with the probability of the contribution of the random variable to each being equal. This breaks the trend in the cases where the random variable does not exist because the random variable of the current value of the sequence has influence on the next value, which results from multiplying the constant by the value before it in time.
I expect the result will be quite "random" and difficult to have further analysis without using the frequency domain techniques for the system. As a comparison, below is another set of results of the generation (the images are clickable, and by clicking, an enlarged one will pop up).
Comparing this with the previous results (and other results I attempted), I can not see a clear trend of the sequence with either value of a. Although this might result of any possible error I made, I can not see any at least for now.
I planned to get this done earlier but really wanted to see if there is more finding. Still, this mini-project will end here unless I think of something else.
MATLAB Code:
Project Script:
% Generate and plot 50 samples for
% 1. a = 0.95
% 2. a = 0.70
% 3. a = -0.95
% 4. |a| > 1
% 1. a = 0.95
[x,k] = RandSeqGenerator8p3(50,0.95);
subplot(2,2,1);
stem(k,x);
axis([-1,50,-26,26]);
title('a = 0.95');
xlabel('time');
ylabel('x[k]');
% 2. a = 0.70
[x,k] = RandSeqGenerator8p3(50,0.70);
subplot(2,2,2);
stem(k,x);
axis([-1,50,-26,26]);
title('a = 0.70');
xlabel('time');
ylabel('x[k]');
% 3. a = -0.95
[x,k] = RandSeqGenerator8p3(50,-0.95);
subplot(2,2,3);
stem(k,x);
axis([-1,50,-26,26]);
title('a = -0.95');
xlabel('time');
ylabel('x[k]');
% 1. |a| > 1
[x,k] = RandSeqGenerator8p3(50,2);
subplot(2,2,4);
stem(k,x);
axis([-1,50,-26,26]);
title('a = 2 (|a| > 1)');
xlabel('time');
ylabel('x[k]');
Random Sequence Generator:
function [ x, k ] = RandSeqGenerator8p3( n, a )
%RandSeqGenerator8p3 Generates n samples of the random sequence:
% x[k] = a*x[k - 1] + b[k],
% a: a constant
% b[k]: a binary white noise sequence taking on values -1 and +1 with
% equal probabilities
%
% x: samples of the random sequence
% k: sample time points
% n: number of samples
x = [];
k = 0:(n - 1);
b = 2*(rand(1,n) < 0.5) - 1;
if n > 0
x(1) = b(1);
if n > 1
for l = 2:n
x(l) = x(l - 1) + b(l);
end
end
end
end
Update on 12/30/2013:
I thought of the random walk today. The random sequence above, when the constant is equal to 1, is actually a random walk if x[k] = 0 for k < 0. In this case, the initial condition x[0] for the random walk is a random signal taking on values of +1 and -1 with equal probabilities.
No comments:
Post a Comment