A Fibonacci sequence is composed of elements created by adding the two previous elements. The simplest Fibonacci sequence starts with 0, 1 and proceeds as follows: 0, 1, 1, 2, 3, 5, 8, 13, . However,...


A Fibonacci sequence is composed of elements created by adding the two previous elements. The simplest Fibonacci<br>sequence starts with 0, 1 and proceeds as follows:<br>0, 1, 1, 2, 3, 5, 8, 13, .<br>However, a Fibonacci sequence can be created with any two starting numbers (a, b).<br>A. Write an m-file that calculates the Fibonacci sequence (10 terms long) as a vector using a for loop with a = 5<br>and b = 8. Use fprintf() to output the sequence. You may want to use num2str() with a %s specifier to print the<br>Fibonacci sequence. Example output below for a = 0, b = 1 with 10 terms.<br>Fibonacci sequence with starting numbers [0, 1] is<br>e 1 1 2 3 5 8 13 21 34<br>B. One interesting property of a Fibonacci sequence is that the ratio of the values of adjacent members of the<br>1+5<br>sequence approaches a number called

Extracted text: A Fibonacci sequence is composed of elements created by adding the two previous elements. The simplest Fibonacci sequence starts with 0, 1 and proceeds as follows: 0, 1, 1, 2, 3, 5, 8, 13, . However, a Fibonacci sequence can be created with any two starting numbers (a, b). A. Write an m-file that calculates the Fibonacci sequence (10 terms long) as a vector using a for loop with a = 5 and b = 8. Use fprintf() to output the sequence. You may want to use num2str() with a %s specifier to print the Fibonacci sequence. Example output below for a = 0, b = 1 with 10 terms. Fibonacci sequence with starting numbers [0, 1] is e 1 1 2 3 5 8 13 21 34 B. One interesting property of a Fibonacci sequence is that the ratio of the values of adjacent members of the 1+5 sequence approaches a number called "golden ratio": 2 Using the same two initial numbers specified in part A, continue calculating Fibonacci terms in the sequence until the ratio of adjacent values converges to the golden ratio within an absolute difference (error) of 10. Plot the calculated ratios against each ratio pair number using cross markers connected with solid lines, and compare with the exact ratio (dashed line) in the same plot. Also, use fprintf() to print the number of Fibonacci terms required to achieve the absolute error. Example output below. 15 Fibonacci numbers needed to achieve absolute error less than 1.000000e-05 Use pen and paper to understand the process before coding this. Example calculations for the first few terms are shown below. Terms = 2 Fibonacci sequence [5, 8] Ratio pair 1 = 8/5 1.6 %3D Error = |1.6 - 5= 0.0180 Terms = 3 Fibonacci sequence = [5, 8, 13] Ratio pair 2 = 13/8 = 1. 625 Error = |1.625 - = 0.0070 Continue until error is below 10.
Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here