Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started