Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In the Fibonacci sequence, Fibonacci assumed that each rabbit took one month to mature. Now assume that rabbits taketwo month to mature. The sequence isdefined


In the Fibonacci sequence, Fibonacci assumed that each rabbit took one month to mature. Now assume that rabbits taketwo month to mature. The sequence isdefined by

g0= 1, g1= 1, g2= 1 and for n > 2 gn= gn-1+ gn-3 sog3= 2

Write the MATLAB code for calculating the Fibonacci number with new conditions, using your code calculate how many pair of rabbits are there after 12 months (so g12)?


Assuming we are using the below functionto calculate Fibonacci numbers:

function f = fibnum(n) % FIBNUM Fibonacci number. % FIBNUM(n) generates the nth Fibonacci number. if n <= 1 f = 1; else f = fibnum(n-1) + fibnum(n-2); end

How many arithmetic, logical, and assignment operations do we need to calculate the nthFibonacci number, i.e. fibnum(n)? (assume each <= , = , + , - is such an operation). Note fibnum(0) == 1 here.

Use matlab notation with no whitespace and no assignment to enter your answer.

Question 3)

Following theprevious question, calculate how many operations you need for calculating fibnum(50). We recommend that you do not use scientific notation. Make sure that your answer is precise.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Calculus Early Transcendentals

Authors: James Stewart

8th edition

1285741552, 9781305482463 , 978-1285741550

More Books

Students also viewed these Databases questions

Question

Describe five of G. Stanley Halls major achievements.

Answered: 1 week ago