www.pudn.com > NumericalComputing.rar > fibonacci.m, change:2001-12-31,size:207b


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