ax = zeros(1,20);
ay = zeros(1,20);
az = zeros(1,20);
L = 100;
width = L;
height = L;
length = L;
num = 2000;
range = 2;
% where to start in the box
ax(1) = 0; %width/2;
ay(1) = 0; %height/2;
az(1) = 0;
for i = 1:num
if rand < .5
ax(i+1) = ax(i) + rand*range;
else
ax(i+1) = ax(i) - rand*range;
end
if rand > .5
ay(i+1) = ay(i) + rand*range;
else
ay(i+1) = ay(i) - rand*range;
end
if rand > .5
az(i+1) = az(i) + rand*range;
else
az(i+1) = az(i) - rand*range;
end
%{
% for animation
figure(i)
plot3(ax,ay,az)
saveas(gcf,['brownian3d_',num2str(i),'_'], 'png')
close(gcf)
%}
end
plot3(ax,ay,az)
% saveas(gcf, 'alpha_beta_1_v_gain', 'png')