Question: Write a function that will use a while loop to calculate and output how many years ( n ) it will take an initial investment
Write a function that will use a while loop to calculate and output how many years n it will take an initial investment P to grow to more than a specified final value Pfinal given an interest rate r It should also store the yearly value of the investment in an array bals
Your function should use the following outputs, name and inputs: nbals makinthatmoneyPPfinal,r
Once the number of years has been calculated, produce a graph of the principal at the beginning of each year. For example the first point should be: P and the last point should be nSomethingALittleBitBiggerThanPfinal
Be careful not to get stuck in an infinite loop! To receive full credit, you must use while loops andor if statement to constrain the inputs to valid values.
IN MATLAB CODE
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
