function fib = fibfun( n )
%Calculates the Fibonacci of n iteratively
%   It is the textbook version of the Fibonacci
% Minas Spetsakis, Feb. 2018

if n<=2
    fib = 1;
    return
end;
fn1=1;
fn=1;
for i=3:n
    t = fn;
    fn = fn + fn1;
    fn1 = t;
end;
fib = fn;
end

