Question: 10. (Taken from Engineering Computations, An introduction using MATLAB and Excel). When an amount of money P in invested at an annual interest rate of
10. (Taken from Engineering Computations, An introduction using MATLAB and Excel). When an amount of money P in invested at an annual interest rate of I (expressed as a decimal value, not as a percentage), the total value of the investment A after n years can be computed as follows: A=P(1+2n We wish to find how many years until the investment reaches a desired amount. Test your code for an initial investment of $10,000, a target value of $100,000 and an interest rate of 10. a. Write MATLAB code to find n to the nearest year using a loop. Prompt the user to enter P, the target amount A, and i, Then, loop until the desired amount is reached b. Write MATLAB code to find the exact number of years using a root-finding technique (either bisection method coded earlier, or fzero). You could use the years found in part a as your initial guess, if you wish. Check your answer to part b using Excel Goal Seek. c. For parts a and b, copy your code below. For part c, include your Excel spreadsheet
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
