% Script 2

figure(1)
steps = [1 2 4 8 16 32 64 128 256];
%steps = [3 6 12 24 48 96 192];
errors = 1*steps;
results = 1*steps;

i = 1;
while (i <= length(steps))
	results(i) = leapfrog1(steps(i));
	i = i + 1;
end
errors = results - 1;

plot([1 2 3 4 5 6 7 8 9], errors);
xlabel('log_2(number of steps)');
ylabel('Error');
title('Graph of error vs. no. of steps');

steps = [1 2 4 8 16 32 64 128 256];
errors2 = 1*steps;
results2 = 1*steps;

i = 1;
while (i <= length(steps))
	results2(i) = leapfrog2(steps(i));
	i = i + 1;
end

figure(2);
plot([1 2 3 4 5 6 7 8 9], results2);
xlabel('log_2(number of steps)');
ylabel('Result');
title('Graph of result vs. no. of steps');
