Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello, this question has been already answered on chegg. Although I am not able

ID: 3027647 • Letter: H

Question


Hello,
this question has been already answered on chegg. Although I am not able to find the solution with Matlab.
I would appreciate if you could send me a picture of how you entered it in Matlab.

Problem An amount of money Pis invested in an account where interest is compounded at the end of the period. The future worth F yielded at an interest rate after n periods may be determined from the following formula: Write an M-file that will calculate the future worth of an investment for each year from 1 through n. The input to the function should include the initial investment P the interest rate t (as a decimal), and the number of years n for which the future worth is to be calculated. The output should consist of a table with headings and columns for n and F. Run the program for P $100,000, i 0.05. and n 10 years.

Explanation / Answer

Solution :

function furtureworth P=input('Enter initial incestment (dollars):'); i=input('Enter the interest rate (decimal):'); n=input('Enter the number of years:');

x = 0:n;

if (i>=0) F=P*(1+i).^x; y = [x;F]; end

if(i<0)||(P<0) fprintf('sorry,the value of i is not valid for calculation '); end

fprintf(' year future worth '); fprintf('%5d %14.2f ',y)

------------------------------------------------------------------------------