[solved]-Need Help Matlab Using Recursion Please Notice Use Recursion Iteration Allowed Thank Help Q39018615
Need help on MATLAB by using Recursion!!!
Please notice that Only use Recursion.
Iteration is not allowed!!!
Thank you for your help!
Function Name: paperOrPlastic
Inputs: 1. (double) Any positive integer
Outputs: 1. (char) A statement about the input number

Function Description: The Collatz conjecture (also known as the 3n+1 conjecture) was proposed by Lothar Collatz in 1937. The conjecture says that any positive integer n can be manipulated to be 1 through the following algorithm: 1) If the number is even, divide it by 2 2) If the number is odd, multiply it by 3 and add 1 3) Repeat (i.e. recursively call the function) Your job is to write a recursive MATLAB function that implements the Collatz conjecture. The recursive algorithm is guaranteed to result in a 1. If the number of steps it took the algorithm to reach 1 is even, output ‘This is paper.’ If the number of steps is odd, output ‘This is plastic.’ Example: out = paperOrPlastic(11) → 20 10 5 16 → 8 – 4 – 2 11 → 34 → 17 → 52 → 26 — 13 40 – 1 Total: 14 steps out → This is paper.’ Notes: • If you try running this function with very large numbers (as in 40-digit numbers), MATLAB will crash as it will reach its maximum recursion limit. Hints: • You may find it useful to make a helper function for this problem. Show transcribed image text Function Description: The Collatz conjecture (also known as the 3n+1 conjecture) was proposed by Lothar Collatz in 1937. The conjecture says that any positive integer n can be manipulated to be 1 through the following algorithm: 1) If the number is even, divide it by 2 2) If the number is odd, multiply it by 3 and add 1 3) Repeat (i.e. recursively call the function) Your job is to write a recursive MATLAB function that implements the Collatz conjecture. The recursive algorithm is guaranteed to result in a 1. If the number of steps it took the algorithm to reach 1 is even, output ‘This is paper.’ If the number of steps is odd, output ‘This is plastic.’ Example: out = paperOrPlastic(11) → 20 10 5 16 → 8 – 4 – 2 11 → 34 → 17 → 52 → 26 — 13 40 – 1 Total: 14 steps out → This is paper.’ Notes: • If you try running this function with very large numbers (as in 40-digit numbers), MATLAB will crash as it will reach its maximum recursion limit. Hints: • You may find it useful to make a helper function for this problem.
Expert Answer
Answer to Need help on MATLAB by using Recursion!!! Please notice that Only use Recursion. Iteration is not allowed!!! Thank you f… . . .
OR

