MATLAB?? Question 1: 2 Marks The Fibonacci sequence defined by F=1,1,2,3,5,8,13,21,34,55,89,…N where the ith term is giv
Posted: Thu May 26, 2022 9:36 am
MATLAB??
Question 1: 2 Marks
The Fibonacci sequence defined by
F=1,1,2,3,5,8,13,21,34,55,89,…N
where the ith term is given
by
F=Fi-1+Fi-2
Write a function
fibGen that accepts a single input into the
variable N. Add code to the function that uses a
for loop to generate the Nthterm in the
sequence and assign the value to the output variable
fib with an unsigned 32-bit integer datatype.
Assume the input N will always be greater than or
equal to 4.
Note the value of N
(StdID) is defined as an input to the function. Do not overwrite
this value in your code. Be sure to assign values to each of the
function output variables.
Use a for loop in your answer.
Question 1: 2 Marks
The Fibonacci sequence defined by
F=1,1,2,3,5,8,13,21,34,55,89,…N
where the ith term is given
by
F=Fi-1+Fi-2
Write a function
fibGen that accepts a single input into the
variable N. Add code to the function that uses a
for loop to generate the Nthterm in the
sequence and assign the value to the output variable
fib with an unsigned 32-bit integer datatype.
Assume the input N will always be greater than or
equal to 4.
Note the value of N
(StdID) is defined as an input to the function. Do not overwrite
this value in your code. Be sure to assign values to each of the
function output variables.
Use a for loop in your answer.