maxn = 20;
for n=1:maxn
    tic 
    fibnum(n);
    tend(n) = toc;
    disp(sprintf('Time for recursive computation of f(%d): %f seconds', n, tend(n)))
end
disp('Note that the time behaves like the Fibonacci sequence itself')
% so do another Fibonacci iteration
f = zeros(52-maxn, 1);
f(1) = tend(maxn-1);
f(2) = tend(maxn);
for k = 3:(52-maxn)
    f(k) = f(k-1) + f(k-2);
end
disp(sprintf('Based on the timings on my computer I would estimated time for f(50): %f hours', double(f(end)/3600)))
%estimate = tend(maxn)*exp((50-maxn)*0.481212);   % based on solution to problem 1
estimate = tend(maxn)*10^((50-maxn)*0.208988);   % based on solution to problem 1
disp(sprintf('An estimate based on the slope computed in the first problem would be: %f hours', double(estimate/3600)))
% Just for comparison
tic; 
fibonacci2(50);
tend = toc;
disp(sprintf('Time for iterative computation of f(50): %f seconds', tend))
