Question: Please solving using MATLAB, NO HARD CODING Thank you :) Function Name: perfectARecipe Inputs: 1. (double) A number representing how many issues your recipe has

Please solving using MATLAB, NO HARD CODING
Thank you :)
Function Name: perfectARecipe Inputs: 1. (double) A number representing how many issues your recipe has Outputs: 1. (double) The number of times you had to tweak your recipe in order to perfect it Topics: (iteration). (conditionals) Background: After years of working your way up from professional dishwasher status, you've finally achieved your dreams and became the head chef of your very own bistro, Le Petit MATLAB! Although it's only been a few weeks since you first opened, you already have such an amazing reputation that Andre Michelin himself has informed you that he will be visiting your restaurant in 3 hours! Upon hearing this news, you take a look through your pantry and realize that you've completely run out of the ingredients that you use to make your normal menu! You know that you can't let such a good opportunity go to waste though, so you grab all of the ingredients you can find and mix them together in hopes of creating a new dish that will blow Andre off his feet. Alas, even after 2 hours of trying your recipe still has a worrying number of flaws. With only an hour left before the fate of your bistro changes forever, you turn towards the salt to your pepper, MATLAB. in hopes of getting your number of errors down to just one, since you know that no matter how hard you try or how many spices you add, peanut butter and flour tortillas just don't go well together. Function Description: You are given the number of errors present in your recipe. Perform the following mathematical operations until the number of errors becomes equal to 1: If the number of errors is even divide it by 2. If the number of errors is odd, multiply it by 3 and add 1. Count how many attempts it takes you to get the number of errors this value as your final answer. be eg 1, and output Example: errors = 13 [count] = perfectARecipe (errors) count = 9 Notes: The input will always be a positive integer
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
