Question: write a mathlab code Jimmy starts an annuity with a principal value of R 1 0 0 0 0 0 0 ( one million Rands

write a mathlab code Jimmy starts an annuity with a principal value of R1000000(one million Rands) and plans to withdraw a fixed amount each month, starting one month after opening the annuity account. Jimmy expects to draw R20000(twenty thousand Rands) from the annuity every month, for 15 years (fifteen years). Suppose the monthly interest rate is fixed at 1.9% 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 15 year time span ends?
For how many months will Jimmy be able to withdraw R20000 without overdrawing on the account?
What is the value of the annuity after the last withdrawal of R20000, before the account is overdrawn?
Use the code below to help answer these questions. The function
AnnuityRecursive(p, 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 a(i) is the value of the anuity at time t(i).
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. % set constants
% pretty print outputs
pretty('Principal', P);
pretty('Withdrawl', W);
pretty('Rate ', R);
pretty('Months ', N);
% Call AnnuityRecursive to construct the t an a vectors
[t a]= AnnuityRecursive(P, W, R, N);
% Answer questions below:
% Will the value of the annuity drop to zero before the 20 year time span ends?
% Yes: 1
% No: 0
Q1=?
% For how many months will Jimmy be able to withdraw R20000 without overdrawing
% on the account?
Q2=?
% What is the value of the annuity after the last withdrawal of R20000, before
% the account is overdrawn?
Q3=?
% This is a generic evaluation check. You cannot edit this.
[Q4t Q4a]= AnnuityRecursive(123456,12345,12/1000,96);
% Plot the results.
plot(t, a,'ob');
xlabel('time [months]');
ylabel('value [Rands]');
title('Remaining Annuity value over time.');
grid;
% define functions
function [t a]= AnnuityRecursive(p, w, r, n)
end
% Use the following functions to pretty print arrays and values
function pretty(s, a)
fprintf(['%s: ' repmat('%1d ',1, numel(a))'
'], s, a);
end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!