Menu

[solved]-Need Help Matlab Using Recursion Please Notice Use Recursion Iteration Allowed Thank Help Q39093420

Need help on MATLAB by using Recursion!!!

Please notice that Only use Recursion.

Iteration is not allowed!!!

Thank you for your help!!

Function Description: Write a recursive function to determine whether or not a number is recyclable. A number is not recyclab

I have 3 test case numbers in the Red Box below. Pleaseuse them!!!

out1_soln = Looks like 13 goes in the trash after all. out2_soln = The number/1371 can be recycled! out3_soln = Looks lik

Function Description: Write a recursive function to determine whether or not a number is recyclable. A number is not recyclable if the sum of the squares of its digits is also not recyclable, with the last non-recyclable number being 1. When taking the sum of squares of a recyclable number’s digits, you will end up with an infinite loop containing the number 4. If the number is recyclable, your function should output: ‘The number <num> can be recycled!’ If the number is not recyclable, your function should instead output: ‘Looks like <num> goes in the trash after all.’ Example: >> out = tearfulRecycling(19) 12 + 92 = 82 62 +82 = 100 82 + 22 = 68 12 + O2 + O2 = 1 out ‘Looks like 19 goes in the trash after all.’ >> out = tearfulRecycling(16) 12 + 62 = 37 32 + 72 = 58 52 + 82 = 89 82 +92 = 145 out — ‘The number 16 can be recycled!’ 12 +42 + 52 = 42 42 + 2 = 20 22 + 02 = 4 42 = 16… Hints: A helper function will be useful in solving this problem. Think about how you can use either num2str() or a combination of mod() and floor() to get the individual digits of a number out1_soln = ‘Looks like 13 goes in the trash after all.’ out2_soln = The number/1371 can be recycled!’ out3_soln = ‘Looks like 314159 goes in the trash after all.’ Show transcribed image text Function Description: Write a recursive function to determine whether or not a number is recyclable. A number is not recyclable if the sum of the squares of its digits is also not recyclable, with the last non-recyclable number being 1. When taking the sum of squares of a recyclable number’s digits, you will end up with an infinite loop containing the number 4. If the number is recyclable, your function should output: ‘The number can be recycled!’ If the number is not recyclable, your function should instead output: ‘Looks like goes in the trash after all.’ Example: >> out = tearfulRecycling(19) 12 + 92 = 82 62 +82 = 100 82 + 22 = 68 12 + O2 + O2 = 1 out ‘Looks like 19 goes in the trash after all.’ >> out = tearfulRecycling(16) 12 + 62 = 37 32 + 72 = 58 52 + 82 = 89 82 +92 = 145 out — ‘The number 16 can be recycled!’ 12 +42 + 52 = 42 42 + 2 = 20 22 + 02 = 4 42 = 16… Hints: A helper function will be useful in solving this problem. Think about how you can use either num2str() or a combination of mod() and floor() to get the individual digits of a number
out1_soln = ‘Looks like 13 goes in the trash after all.’ out2_soln = The number/1371 can be recycled!’ out3_soln = ‘Looks like 314159 goes in the trash after all.’

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


Leave a Reply

Your email address will not be published. Required fields are marked *