(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
==<center>Markov Chains</center>==
+
==<center>Markov Processes</center>==
<center>[[User:Green26|(alec green)]]</center>
+
 
 +
I attempted to model a robot circulating about the origin with small noise in each step.  You can directly plug in the Matlab code below.  It generated the following images, showing the putative robot spiraling 'inward' or 'outward'.  Normally distributed random variables are used to modify the magnitude (M) of the complex vector and rotate the vector in a clockwise direction with a rotation (R) r.v. during each state transition.
 +
 
 +
The (first-order, stationary, discrete time, continuous state-space) Markov process representing this simple 'walk' is as follows:
 +
 
 +
<math>
 +
X_{t+1} = \mathrm{M}X_t\mathrm{e}^{-j|\mathrm{R}|},\; \mathrm{where} \;\; \mathrm{M} \sim \mathcal{N}(1,.01),\; \mathrm{R} \sim \mathcal{N}(0, .01)
 +
</math>
  
I attempted to model a robot circulating about the origin with small noise in each step.  You can directly plug in the following Matlab code.  It generated the following images, showing the putative robot spiraling 'inward' or 'outward'.  I assume this is a result of the butterfly effect; that is, noise early in the walk process has a greater effect on the final position of the robot than noise later in the walk process.
 
  
 
<center>
 
<center>
[[image: Robot_1.PNG | inward spiral]]
+
[[image: Robot_1.PNG | Inward Spiral]]
[[image: Robot_2.PNG | outward spiral]]
+
[[image: Robot_2.PNG | Outward Spiral]]
 
</center>
 
</center>
 +
 +
 +
Question: Does the noise early in the walk process have a greater effect on the final position of the robot than noise later in the walk process, suggesting a 'butterfly effect'?  The second image appears to suggest otherwise, since the robot spirals out early but later spirals inward ending at the red square.
  
 
<pre>
 
<pre>
 
% set params
 
% set params
 
num_steps = 10000;
 
num_steps = 10000;
std_dev_rot = .01;
+
std_rot = .01;
std_dev_noise_mag = .01;
+
std_noise_mag = .01;
  
 
% generate random initial state with complex magnitude 1
 
% generate random initial state with complex magnitude 1
Line 20: Line 29:
 
% generate next states (probabilistic modifications on current state)
 
% generate next states (probabilistic modifications on current state)
 
for j=2:length(walk),
 
for j=2:length(walk),
   walk(j) = walk(j-1)*normrnd(1,std_noise_mag)*(i^(-abs(normrnd(0,std_rot))));
+
   walk(j) = walk(j-1)*normrnd(1,std_noise_mag)*(exp(-i*abs(normrnd(0,std_rot))));
 
end;
 
end;
 
plot(walk); grid on; hold on;
 
plot(walk); grid on; hold on;
  
% plot starting (green) and end (red) squares
+
% plot starting (green) and end (red) markers
 
plot(walk(1), 'gs','LineWidth', 2);
 
plot(walk(1), 'gs','LineWidth', 2);
 
plot(walk(length(walk)), 'rs','LineWidth', 2);
 
plot(walk(length(walk)), 'rs','LineWidth', 2);
  
% generate circle to compare with "robot" circulation
+
% generate black circle to compare with "robot" circulation
 
circ = zeros(1,1000);
 
circ = zeros(1,1000);
 
circ(1) = i;
 
circ(1) = i;

Latest revision as of 14:14, 1 May 2016

Markov Processes

I attempted to model a robot circulating about the origin with small noise in each step. You can directly plug in the Matlab code below. It generated the following images, showing the putative robot spiraling 'inward' or 'outward'. Normally distributed random variables are used to modify the magnitude (M) of the complex vector and rotate the vector in a clockwise direction with a rotation (R) r.v. during each state transition.

The (first-order, stationary, discrete time, continuous state-space) Markov process representing this simple 'walk' is as follows:

$ X_{t+1} = \mathrm{M}X_t\mathrm{e}^{-j|\mathrm{R}|},\; \mathrm{where} \;\; \mathrm{M} \sim \mathcal{N}(1,.01),\; \mathrm{R} \sim \mathcal{N}(0, .01) $


Inward Spiral Outward Spiral


Question: Does the noise early in the walk process have a greater effect on the final position of the robot than noise later in the walk process, suggesting a 'butterfly effect'? The second image appears to suggest otherwise, since the robot spirals out early but later spirals inward ending at the red square.

% set params
num_steps = 10000;
std_rot = .01;
std_noise_mag = .01;

% generate random initial state with complex magnitude 1
walk = zeros(1,num_steps);
walk(1) = exp(i*rand);
% generate next states (probabilistic modifications on current state)
for j=2:length(walk),
  walk(j) = walk(j-1)*normrnd(1,std_noise_mag)*(exp(-i*abs(normrnd(0,std_rot))));
end;
plot(walk); grid on; hold on;

% plot starting (green) and end (red) markers
plot(walk(1), 'gs','LineWidth', 2);
plot(walk(length(walk)), 'rs','LineWidth', 2);

% generate black circle to compare with "robot" circulation
circ = zeros(1,1000);
circ(1) = i;
for j=2:length(circ),
  circ(j) = circ(j-1)*i^(2*pi/length(circ));
end;
plot(circ,':k','LineWidth', 2); hold off;

Alumni Liaison

Questions/answers with a recent ECE grad

Ryne Rayburn