I'm simulating atomic jumps in a 1D lattice.
This code takes a series of 30 of a sequence of 100 random single integer atomic jumps and plots them on a single plot.
for i=1:30
n = 100;
P = zeros(n,1);
P(1) = 0;
for i=2:n
R = rand;
if R < 0.5
S = -1;
elseif R > 0.5
S = 1;
end
P(i) = S+P(i-1)
end
ylabel('Position')
xlabel('Jump Count')
title('Random Atomic Jumps in a 1-D Lattice')
plot(1:n,P)
hold on
end
Can you help provide the code to create a histogram of the 30 y-axis positions on this plot, at x=100?
0 Comments
Sign in to comment.