Fibonacci sequence - very easy

by

 

This prints a set of Fibonacci series

fibonacci.m
%=======================================================================
%==  Easiest Fibonacci Series :)                         
%==  Copyright (c) 2013, Sumit Pokhrel(sumitpokhrel2003@gmail.com)
%==  All rights reserved        
%==  Aerospace Engineering, Texas A&M University, College Station,TX  
%=======================================================================
clc
clear all 
a=1;b=0;c=0;
for i =1:1:10;% generates 20 numbers 
    a=a+b;% first addition
    c=c+1;% counter for array 
    x(c,1)=a; % putting in a column array 
    b=b+a;% second addition 
    c=c+1;
    x(c,1)=b;
end

Contact us