Question: Exercise 3 (Fibonacci Sequence) The Fibonacci sequence is given as Fn = Fn-1 + Fn-2 = with Fo = Fi = 1 for n E

Exercise 3 (Fibonacci Sequence) The Fibonacci sequence is given as Fn = Fn-1 + Fn-2 = with Fo = Fi = 1 for n E N. a) Write a Matlab program fibonacci.m which can be used to calculate the first n Fibonacci numbers. Use a for loop. b) Write a second Matlab program fibonaccivect.m which calculates the the first n Fibonacci numbers in a vectorized manner. To this end use the following formula for the Fibonacci numbers: n 1 1+ 1- Fn ((( 14, 15) (5) V5 2 2 -1 c) To validate your code, print for a) and b) Fn/Fn-1. In the limit this quotient should approach (1+5)/2. - Submit the Matlab files and the output of the ratio Fn/Fn-1 for a) and b) for n= 1, ..., 30 (the latter in plain text)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
