from
Fibonacci Number Generator
by Jesse
This is a program that generates any desired amount of fibonacci numbers.
|
| [f]=fibonacci(n)
|
%ECS 200 Project
function [f]=fibonacci(n)
%Author: Jesse Friedland
%the following function Fibonacci(n) will create the first n number of
%terms in a fibonacci sequence.
%Inputs: n ---> The number of terms in the
% fibonacci sequence one desires
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