Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Fibonacci sequence is fib ,1. 2. 3. 5, 8. 13. 21, 34. 55, 89, where the Nth

ID: 3713706 • Letter: T

Question

The Fibonacci sequence is fib ,1. 2. 3. 5, 8. 13. 21, 34. 55, 89, where the Nth term, is given by Write a function that accepts a single scalar input, N, and computes the Nth term of the sequence. (It should call recursive fibonacci to calculate earlier terms.) Each time your function assigns a value to F, save this value in ASCII format to the data file "recursion_check.dat. Be sure to use the -append option so the file is not overwritten with each save. The test suite will examine this file to check the stack and ensure you have solved the problem using recursion #FILE Your Function C Reset MATLAB Documentation function [Frecursive fibonacci(N) if(Ne-1) 4 elseif (N--2) else F-recursive_fibonacci(N-1)+ recursivefibonacci(N-2); save recursioncheck.dat end end 12 %Enter commands her to generate the outputs specified in the problem statement using the input N. You can change the variable names : Code to call your function C Reset [Frecursive fibonacci(N-1)

Explanation / Answer

use the following line to replace your existing line 8 for saving- (It would be good to write the save line after end of if-elseif-else-end block)

save('recursion_check.dat', 'F', '-append', '-ascii')


You can then test your function using the following-

F= recursive_fibonacci(6) %to calculate the 6th fibonacci term

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote