(Solved) : Use Octave Matlab Programs Code Use Disp Num2str Also Use Break Continue Statements Q42705998 . . .

Use octave or MATLAB as programs to code.

Do not use disp or num2str.

Also, do not use break or continue statements.​​​​​​​In this problem we will modify the code for the Fibonacci sequence developed in class to give more output. Recall that the Fi

In this problem we will modify the code for the Fibonacci sequence developed in class to give more output. Recall that the Fibonacci numbers are 0,1, 1, 2,3,5,8,… and can be defined recursively for n 3 as Fibonacci(n) Fibonacci (n 1)Fibonacci(n 2) with Fibonacci() = 0 and Fibonacci (2) 1 Write a program that calls a function get-positive integer which should keep prompting the user and giving error messages until a positive integer is entered return the resulting value The main program should then call a recursive function fibonacci which should take in an integer n for which Fibonacci number to compute and an integer indicating how many times (including the current call) the function has been called upon entry, print a debug message displaying the values of the input variables call itself recursively as needed to calculate the specified Fibonacci number return the requested Fibonacci number and the counter of the number of calls to the fibonacci function The main program should then display the final result. Hint: Remember how to call a function that returns two variables. Sample output: Enter a positive integer: -2 Invalid entry -2 Enter a positive integer: 3.5 Invalid entry 3.5 Enter a positive integer: 5 1 to compute Fibonacci( 5 ) 2 to compute Fibonacci( 4 ) 3 to compute Fibonacci( 3) 4 to compute Fibonacci( 2 ) to compute Fibonacci( 1 6 to compute Fibonacci( 2 ) Fibonacci: Enter on call Fibonacci: Enter on call Fibonacci: Enter on call Fibonacci: Enter on call Fibonacci: Enter on cal Fibonacci: Enter on call 7 to compute Fibonacci( 3) 8 to compute Fibonacci( 2) 9 to compute Fibonacci( 1 ) Fibonacci: Enter on call Fibonacci: Enter on call Fibonacci: Enter on call Fibonacci number 5 is 3 Below is a figure that might help explain the above sample output Fibonacci 5) Fibonacci ( 4) Fibonacci( 3) Fibonacci 3) Fibonacci 2) Fibonacci ( 1 Fibonacci( 2) ) Fibonacci (1) Fibonacci ( 2 ) Show transcribed image text In this problem we will modify the code for the Fibonacci sequence developed in class to give more output. Recall that the Fibonacci numbers are 0,1, 1, 2,3,5,8,… and can be defined recursively for n 3 as Fibonacci(n) Fibonacci (n 1)Fibonacci(n 2) with Fibonacci() = 0 and Fibonacci (2) 1 Write a program that calls a function get-positive integer which should keep prompting the user and giving error messages until a positive integer is entered return the resulting value The main program should then call a recursive function fibonacci which should take in an integer n for which Fibonacci number to compute and an integer indicating how many times (including the current call) the function has been called upon entry, print a debug message displaying the values of the input variables call itself recursively as needed to calculate the specified Fibonacci number return the requested Fibonacci number and the counter of the number of calls to the fibonacci function The main program should then display the final result. Hint: Remember how to call a function that returns two variables. Sample output: Enter a positive integer: -2 Invalid entry -2 Enter a positive integer: 3.5 Invalid entry 3.5 Enter a positive integer: 5 1 to compute Fibonacci( 5 ) 2 to compute Fibonacci( 4 ) 3 to compute Fibonacci( 3) 4 to compute Fibonacci( 2 ) to compute Fibonacci( 1 6 to compute Fibonacci( 2 ) Fibonacci: Enter on call Fibonacci: Enter on call Fibonacci: Enter on call Fibonacci: Enter on call Fibonacci: Enter on cal Fibonacci: Enter on call 7 to compute Fibonacci( 3) 8 to compute Fibonacci( 2) 9 to compute Fibonacci( 1 ) Fibonacci: Enter on call Fibonacci: Enter on call Fibonacci: Enter on call Fibonacci number 5 is 3 Below is a figure that might help explain the above sample output Fibonacci 5) Fibonacci ( 4) Fibonacci( 3) Fibonacci 3) Fibonacci 2) Fibonacci ( 1 Fibonacci( 2) ) Fibonacci (1) Fibonacci ( 2 )

Expert Answer


Answer to Use octave or MATLAB as programs to code. Do not use disp or num2str. Also, do not use break or continue statements.​�…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?