Code covered by the BSD License  

Highlights from
Numerical Computing with Simulink, Vol. 1

image thumbnail

Numerical Computing with Simulink, Vol. 1

by

 

08 Sep 2007 (Updated )

This sequel to Numerical Computing with MATLAB explores the mathematics of simulation.

Fibonacci_Mfile(n)
function Fibonacci_Mfile(n)
% FIBONACCI Fibonacci sequence
% f = FIBONACCI(n) sequentially finds the first n
% Fibonacci numbers and displays them on the command line.

Display1 = {'  Index    Fibonacci Number'};
Display = [];
i  = 0;
f1 = 1;
f2 = 2;
while i <= n
    i = i+1;
    f  = f1 + f2;
    Display = [Display; [i f]];
    f2 = f1;
    f1 = f;
end
Display1
Display

Contact us