Question: This is a mathlab code Jimmy starts an annuity with a principal value of R 1 0 0 0 0 0 0 ( one million
This is a mathlab code Jimmy starts an annuity with a principal value of Rone million Rands and plans to withdraw a fixed amount each month, starting one month after opening the annuity account. Jimmy expects to draw Rtwenty thousand Rands from the annuity every month, for years fifteen years Suppose the monthly interest rate is fixed at and that interest is computed each month on the annuity before the withdrawal made. The annuity is overdrawn when its value drops below zero.
Answer the following questions:
Will the value of the annuity drop to zero before the year time span ends?
For how many months will Jimmy be able to withdraw R without overdrawing on the account?
What is the value of the annuity after the last withdrawal of R before the account is overdrawn?
Use the code below to help answer these questions. The function
AnnuityRecursivep w r n
takes as input the principle value p the monthly withdrawal amount w the iterest rate r and the number of months n and returns a vector t of months and a vector a of annuity values such that ai is the value of the anuity at time ti
Note: This task will require several iterations to complete and several iterations to determine the necessary values. The code provided will generate a plot of your simulation values to help you complete the task. You can run your code on the system before submitting your soulution for grading. this is the response i am getting Variable Qt has an incorrect value. this is my code set constants
P ; Principal in Rands
W ; Withdrawal in Rands
R ; Monthly interest rate
N ; Number of months years
pretty print outputs
prettyPrincipal P;
prettyWithdrawl W;
prettyRate R;
prettyMonths N;
Call AnnuityRecursive to construct the t an a vectors
t a AnnuityRecursiveP W R N;
Answer questions below:
Call AnnuityRecursive function
t a AnnuityRecursiveP W R N;
Will the value of the annuity drop to zero before the year time span ends?
Yes:
No:
Will the value drop to zero before years?
Q doubleanya ; QYes if any value is below zero, No otherwise
For how many months will Jimmy be able to withdraw R without overdrawing
on the account?
Q finda 'last';
What is the value of the annuity after the last withdrawal of R before
the account is overdrawn?
Value of the annuity after the last withdrawal before overdrawing
if Q lengtha
Q aQ;
else
Q;
end
This is a generic evaluation check. You cannot edit this.
Qt Qa AnnuityRecursive;
Plot the results.
plott aob;
xlabeltime months;
ylabelvalue Rands;
titleRemaining Annuity value over time.;
grid;
define functions
function t a AnnuityRecursivep w r n
t :n; Time vector
a zerossizet; Initialize annuity value vector
a p; Initial principal value
for i :n
ai ai rw;
if ai
ai
break;
end
end
end
Use the following functions to pretty print arrays and values
function prettys a
fprintfs: repmatd numela
s a;
endWill the value of the annuity drop to zero before the year time span
ends?
For how many months will Jimmy be able to withdraw R without
overdrawing on the account?
What is the value of the annuity after the last withdrawal of Rthe
next attempt will overdraw on the account
Correctly written 'AnnuityRecursive' Function t
Variable Qt has an incorrect value.
Feedback is shown for the initial error only, as subsequent failures may be due to the first error
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
