Code covered by the BSD License  

Highlights from
Using Numerical Computing with MATLAB in the Classroom

from Using Numerical Computing with MATLAB in the Classroom by Cleve Moler
M-files used in the webinar held on April 27, 2004.

fibonacci(n)
function f = fibonacci(n)
%FIBONACCI  Fibonacci sequence
%   f = FIBONACCI(n) generates the first n Fibonacci numbers.
f = zeros(n,1);
f(1) = 1;
f(2) = 2;
for k = 3:n
   f(k) = f(k-1) + f(k-2);
end

Contact us at files@mathworks.com