MathWorks Interview Question

Write an algorithm for generating the Fibonacci sequence and how would you optimise it.