[Solved]Function Name Tearfulrecycling Inputs 1 Double Positive Integer Recycle Outputs 1 Char Cha Q37066541
MATLAB
Function Name: tearfulRecycling Inputs: 1. (double) A positive integer to recycle Outputs: 1. (char) A character vector describing whether or not the input is recyclable Background: As is true for every mathematician, numbers are near and dear to you. However, it’s the time of year for spring cleaning, and you’re starting to realize that your dorm is a little messy from all the numbers you have lying around. There’s a half-eaten 314 in the fridge, you’ve spilled 163 on the carpet, and you might even have left a 1729 in your car the other day. As hard as it is to part with them, it’s time, and so you consult MATLAB to see which ones you can recycle 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) 1292 82 82 + 22 – 68 62 82- 100 12 +02 02- out → ‘Looks like 19 goes in the trash after all.. >> out -tearfulRecycling (16) 1262 37 327258 52 + 82-89 82 + 92 – 145 12 42 52 42 42 + 22-20 2202 42 16.. ‘The number 16 can be recycled!’ out 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 » » Show transcribed image text Function Name: tearfulRecycling Inputs: 1. (double) A positive integer to recycle Outputs: 1. (char) A character vector describing whether or not the input is recyclable Background: As is true for every mathematician, numbers are near and dear to you. However, it’s the time of year for spring cleaning, and you’re starting to realize that your dorm is a little messy from all the numbers you have lying around. There’s a half-eaten 314 in the fridge, you’ve spilled 163 on the carpet, and you might even have left a 1729 in your car the other day. As hard as it is to part with them, it’s time, and so you consult MATLAB to see which ones you can recycle 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 «num» goes in the trash after all.’ Example: >> out -tearfulRecycling(19) 1292 82 82 + 22 – 68 62 82- 100 12 +02 02- out → ‘Looks like 19 goes in the trash after all.. >> out -tearfulRecycling (16) 1262 37 327258 52 + 82-89 82 + 92 – 145 12 42 52 42 42 + 22-20 2202 42 16.. ‘The number 16 can be recycled!’ out 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 » »
Expert Answer
Answer to Function Name: tearfulRecycling Inputs: 1. (double) A positive integer to recycle Outputs: 1. (char) A character vector … . . .
OR

