Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Fibonacci numbers are computed using the relationship F_n = F_n-1 + F_n-2 wh

ID: 3678042 • Letter: T

Question

The Fibonacci numbers are computed using the relationship F_n = F_n-1 + F_n-2 where F_0 and F_1 are defined equal to 1. Write a function that takes a positive integer value and computes the Fibonacci numbers from 1 to that integer. Execute for at least 3 positive integers. Compute the first 100 Fibonacci numbers and plot. The ratio of F_n/F_n-1 converges to the Golden Ratio (1 + sqrt(5))/2 = 1.618033989... Compute the number of Fibonacci numbers necessary to achieve less than 0.01% difference between the ratio of F_n/F_n - 1 and the Golden Ratio.

Explanation / Answer

A)

function f = fibonacci(n)
f = zeros(n,1);
f(1) = 1;
f(2) = 2;
for k = 3:n
f(k) = f(k-1) + f(k-2);
end

if we let fn denote the golden ratio continued fraction truncated at n terms, then fn = fn/fn-1
compute 100 Fibonacci numbers.
n = 100;
f = fibonacci(n);
Then compute their ratios.
r = f(2:n)./f(1:n-1)
Compute ratio = (1+sqrt(5))/2
Series = 2,3/2,5/3,8/5,13/8,21/13,34/21,55/34,89/55

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote