This repository has been archived on 2021-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
scientificComputing/programming/exercises/randomwalkscriptc.m

21 lines
318 B
Matlab

thresh = 50.0;
probs = [0.5 0.52 0.55 0.6];
maxt = 0;
for sp = 1:4
p = probs(sp);
subplot(2, 2, sp);
hold on
for k = 1:30
x = randomwalkthresh(p, thresh);
if maxt < length(x)
maxt = length(x);
end
plot(x)
end
hold off
title(sprintf('p=%g', p))
xlabel('Time')
xlim([0 maxt])
ylabel('Position')
end