function y = fibonacci(n)
% Fibonacci sequence

if n == 1 
    y = 1;
elseif n == 2
    y = 1;
else 
    ym1 = 1;
    ym2 = 1;
    k = 2;
    while k < n
        
        y = ym1 + ym2;
        ym2 = ym1;
        ym1 = y;
        k = k+1;
    end
end
