from
Fibonacci
by Gholamreza (Shahab) Anbarjafari
The following function generate the fibinacci series up to the sequence number m.
|
| n=fibonacci(m)
|
%
% The following function generate the fibinacci series up to the sequence
% number m which should be a positive integer, it may takes
% several minutes for big numbers of m, for a typical working station
% m>20 is taking considerable amount of time to be processed.
%
% Feel free to contact us for any furthur information:
% {hasan.demirel, shahab.jafari}@emu.edu.tr
% http://faraday.ee.emu.edu.tr/shahab
% http://faraday.ee.emu.edu.tr/hdemirel
% (c) Demirel and Anbarjafari -2008
%
function n=fibonacci(m)
if m<=0
display('fibonacci series is defined for postive numbers!');
else
if m<3
n=1;
else
n=fibonacci(m-1)+fibonacci(m-2);
clear memory
end
end
|
|
Contact us at files@mathworks.com