Question

7. A Fibonacci sequence is composed of elements created by adding the two previous elements. The simplest Fibonacci sequence starts with 1, 1 and proceeds as follows: 1,1,2,3,5,8,13, So, if f(1)-1 and f(2) -1, then f(3)-2)+f(1) We can represent this pattern as f(x) - f(x-1)+f(x-2). A Fibonacci sequence can be created with any two numbers. Prompt the user to enter the first two numbers in a Fibonacci sequence and the total number of elements requested in the sequence. Find the sequence and store it in a for loop. Now plot your resulits on a polar graph. Use the element for the angle and the value of the element in e sequence for the radius. Fibonacci sequences appear regularly in nature. For example, the shell of a chambered nautilus grows in accordance with a Fibonacci sequence.

USING MATLAB

0 0
Add a comment Improve this question Transcribed image text
Answer #1

% get user input

n = input('Enter no of terms in the series : ');

% get user input

a = input('Enter first number : ');

b = input('Enter second number : ');

% store the angle

theta = [ 1 : n ];

% create a vector to store the fibonacci series

rho = zeros( 1 , n );

% set the first 2 terms in the series

rho(1) = a;

rho(2) = b;

for i = 3 : n

   

    % F(n) = F(n - 1) + F(n - 2)

    rho(i) = rho(i - 1) + rho(i - 2);

   

end

% create a polar plot

polarplot(theta,rho);

Add a comment
Know the answer?
Add Answer to:
USING MATLAB 7. A Fibonacci sequence is composed of elements created by adding the two previous...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • this is using MATLAB 2. Fibonacci sequence: A Fibonacci sequence is composed of elements created by...

    this is using MATLAB 2. Fibonacci sequence: A Fibonacci sequence is composed of elements created by adding the two previous elements. The simplest Fibonacci sequence starts with 1,1 and proceeds as follows: 1, 1, 2, 3, 5, 8, 13, . However, a Fibonacci sequence can be created with any two starting numbers. Create a MATLAB function called FL_fib_seq' (where F and L are your first and last initials) that creates a Fibonacci sequence. There should be three inputs. The first...

  • Flowcharts & for loops 1. Using a for loop, write a MatLab script to convert ounces...

    Flowcharts & for loops 1. Using a for loop, write a MatLab script to convert ounces to grams for 0 to 16 ounces, in 1-ounce increments. Present output in a table; label columns appropriately. 2. A Fibonacci sequence is composed of elements created by adding the previous 2 elements. The simplest Fibonacci sequence starts with 1, 1 and proceeds as follows: 1,1,2,3,5,8… Element 3 is the sum of elements 1 and 2 (1+1=2) Element 4 is the sum of elements...

  • 3[20%] | Fibonacci numbers are the numbers in a sequence in which the first two ele-...

    3[20%] | Fibonacci numbers are the numbers in a sequence in which the first two ele- ments are 0 and 1, and the value of each subsequent element is the sum of the previous two elements: 0,,,2,3, 5, 8, 13, Write a MATLAB program in a script file that determines and displays the first 20 Fibonacci numbers.

  • 4. One interesting property of a Fibonacci sequence is that the ratio of the values of...

    4. One interesting property of a Fibonacci sequence is that the ratio of the values of adjacent members of the sequence approaches a number called "the golden ratio". Create a program that accepts the first two numbers of a Fibonacci sequence as user input and then calculates additional values in the sequence until the ratio of adjacent values converges to within 0.001 You can do this in a while loop by comparing the ratio of element k to element k...

  • I need help integrating to find the PDF CDF in MATLAB. (a) 1. Generate six sequences of uniform random variables (length 10,000) in the range [-0.5,0.5]. Each element in the ith sequence can be consi...

    I need help integrating to find the PDF CDF in MATLAB. (a) 1. Generate six sequences of uniform random variables (length 10,000) in the range [-0.5,0.5]. Each element in the ith sequence can be considered to be one realization of the random variable X, for i- 1,2,..., 6. Note that these six uniform random variables are independent and identically distributed. Com- pute new random variables as follows: 6 i-1 This results in two new sequences, the elements of which can...

  • Compute the following problems using Math Lab.   Instructions: Answer All Questions using MATLAB commands. Question 1....

    Compute the following problems using Math Lab.   Instructions: Answer All Questions using MATLAB commands. Question 1. Create a vector of the even whole numbers between 31 and 75. Question 2. Let x [2516] a. Add 16 to each element b. Add 3 to just the odd-index elcments c. Compute the square root of each element d. Compute the square of each element Question 3. Let x 13 268T and y [4 1 3 5] (NB. x and y should be...

  • Using MATLAB 15. Write a program that: a. b. c. Accept two numbers n and m...

    Using MATLAB 15. Write a program that: a. b. c. Accept two numbers n and m in the range of 1-6 Define three arrays A, B and Cof size n by m. (n-# of rows, m-H of columns) Fill the elements of array A by A(ij)-itj i-5 d. Fill the elements of array B by B(ij)ij e. Fill the elements of array C with the average of the corresponding elements of A f. g. h. and B Print the results...

  • Done in matlab In mathematics, two quantities are in the golden ratio if their ratio is...

    Done in matlab In mathematics, two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. a + b a for a b>0 Mathematicians since Euclid have studied the properties of the golden ratio, including its appearance in the dimensions of a regular pentagon and in a golden rectangle, which may be cut into a square and a smaller rectangle with the same aspect ratio....

  • MATLAB Create a function that provides a definite integration using Simpson's Rule Problem Summar This example demo...

    MATLAB Create a function that provides a definite integration using Simpson's Rule Problem Summar This example demonstrates using instructor-provided and randomized inputs to assess a function problem. Custom numerical tolerances are used to assess the output. Simpson's Rule approximates the definite integral of a function f(x) on the interval a,a according to the following formula + f (ati) This approximation is in general more accurate than the trapezoidal rule, which itself is more accurate than the leftright-hand rules. The increased...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT