Page 1 of 1

Iterative Fibonacci (scalar output, integer datatype) My Solutions The Fibonacci sequence defined by F = 1.1.2.3.5.8.13.

Posted: Wed Apr 27, 2022 2:38 pm
by answerhappygod
Iterative Fibonacci Scalar Output Integer Datatype My Solutions The Fibonacci Sequence Defined By F 1 1 2 3 5 8 13 1
Iterative Fibonacci Scalar Output Integer Datatype My Solutions The Fibonacci Sequence Defined By F 1 1 2 3 5 8 13 1 (26.16 KiB) Viewed 58 times
Iterative Fibonacci Scalar Output Integer Datatype My Solutions The Fibonacci Sequence Defined By F 1 1 2 3 5 8 13 2
Iterative Fibonacci Scalar Output Integer Datatype My Solutions The Fibonacci Sequence Defined By F 1 1 2 3 5 8 13 2 (24.42 KiB) Viewed 58 times
Iterative Fibonacci (scalar output, integer datatype) My Solutions The Fibonacci sequence defined by F = 1.1.2.3.5.8.13.21, 34,55,89..... where the kil term is given by =F+ Code has already been provided to define a function named fibGenerator that accepts a single input value into the variable N. Add code to the function that uses a for loop to generate the term in the sequence and assign this 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 3. Note the value of N is defined as an input to the funciton. 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 solution

Function Save Reset MATLAB Documentation 1 function fib = fibGenerator(N) 2 *[fib] = fibGenerator(N) 38 4 Uses iteration to compute the nth term in the Fibonacci sequence 5 6 % 1123 5 8 13 21 34 55 89 ... 7 % 8 fib_nm1 = uint32(1); 9 fib_nm2 = uint32(); 10 for k = 3: ; fib = fib_nml + fib_nm2 = fib_nm1; fib_nmi = 14 end 11 12 13 Code to call your function e Reset 1 [fib) = fibGenerator (5)