Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started