Final answer:
To calculate the future worth of an investment, create an M-file that calls a function taking inputs of initial investment, interest rate, and the number of years. Run the program for specific values and create a plot of the annual balance.
Step-by-step explanation:
To calculate the future worth of an investment for each year from 1 through n, you can create an M-file that calls a function. The function should take inputs including the initial investment (P), the interest rate (i), and the number of years (n). Make sure to develop the function before calling it in the M-file.
For part b), you can run the program for P = $100,000, i = 0.05, and n = 10 years by calling the function from the script file using its name. For part c), you can run the program for P = $150,000, i = 0.05, and n = 10 years by calling the function from the same script file using a function handle.
To create a plot of the annual balance from year 1 through year 10, you can label the axis and provide a title, as mentioned in parts a) and b).