%%%%%%%
% pancakeplotter.m
% Author: Lance Harden, Davidson College
% June 2006
%
% Description: Used in conjunction with the signedperms and bigtrial
% functions, pancakeplotter plots a curve displaying the survival rate
% of bacteria versus the number of flips that have occurred for every
% initial permutation. Its inputs are the same as those of its nested
% functions: k = number of pancakes, n = number of trials, br = number of
% flips per trial.
function [curve] = pancakeplotter(k,n,br)
curve = [];
A = bioperms(k);
nperms = (2^k)*factorial(k) / 2;
for i = 1:nperms
bigbox = bigtrial(2,'s',A(i,:),n,br);
curve(i,:) = sum(bigbox)/n;
end
curve = curve';
plot (curve, 'DisplayName','curve', 'YDataSource', 'curve'); figure(gcf)