% fibonacci_ratio.m
%  Evaluate the Fibonacci ratio using a two-step stepping stone.
%
n = input ( 'Enter the maximum element index: ' );

for i = 0 : n

  if ( i == 0 )
    f = 1;
  elseif ( i == 1 )
    fold = f;
    f = 1;
  else
    foldest = fold;
    fold = f;
    f = fold + foldest;
  end

  if ( 0 < i )
    fprintf ( 'R(%d) = %20.16g\n', i, f / fold );
  end

end

