Question: Write a function which has three input arguments: monthly deposit monthly interest rate savings goal and two output arguments: months final account balance which will
Write a function which has three input arguments:
monthly deposit
monthly interest rate
savings goal
and two output arguments:
months
final account balance
which will calculate how many months it takes to save savings goal amount assuming you will be depositing monthly deposit and the bank pays out monthly interest rate. You can name your inputoutput arguments whatever you like, but their order has to be as specified above and the function has to be called savings.
You can run the function for any inputs you like to check if it compiles. "Run pretests" will check it against test values embedded in the pretest.
Note:The answer should be given as a function in the window called "Function".
Hint:Note that the base of the solution is same as for task Copy your previous code and modify accordingly for it to become a function. Remember that the function should not have the clearcommand anywhere. Also, any parameterschangable variables should be passed in as input arguments not having specific values defined within the function body The exceptions are for instance initialization of summation variable say S or creating an empty vector before the loop V they belong to the calculation algorithm, so should be within the function body. I need the answer in matlab code, thank you.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
