Fibonacci series programming in MATLAB and Simulink Model for beginners

This video explains how to implement the Fibonacci series algorithm using MATLAB function and Simulink Model in simple steps.

We will be glad to hear from you regarding any query, suggestions or appreciations at: programmerworld1990@gmail.com

MATLAB Source code:

function [outputArg] = myFibonacci(inputArg)

if inputArg <=0
outputArg = [];
return;
end

if inputArg == 1
outputArg = 0;
return
end

% outputArg = zeros(1, inputArg);

outputArg = [0 1];
for i=3:inputArg
outputArg = [outputArg outputArg(1, i-2)+outputArg(1, i-1)];
end

end

Simulink Model and output:

fibonacci
Fibonacci_Scope
Fibonacci_Scope1

Leave a Reply

%d bloggers like this: