about summary refs log tree commit diff
path: root/usth/MATH2.4/hw/fibonacci.m
blob: 340c1083bca98bcb97b998efa6b4176c76f49fa4 (plain) (blame)
1
2
3
4
5
6
7
function fib = fibonacci (n)
  fib = 0 : n;
  for i = 2 : n
    fib(i + 1) = fib(i) + fib(i - 1);
  end
  fib = fib(2:end);
end