Revision as of 09:17, 16 February 2013 by Green26 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Markov Chains

(alec green)

Here's an attempt to model a robot circulating about the origin with small noise in each step:

% set params
num_steps = 10000;
std_dev_rot = .01;
std_dev_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)*(i^(-abs(normrnd(0,std_rot))));
end;
plot(walk); grid on; hold on;

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

% generate 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