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

Do in Matlab (octave) 1. You are in charge of managing the cash account for your

ID: 3725535 • Letter: D

Question

Do in Matlab (octave)

1. You are in charge of managing the cash account for your company, which initially has no money in it. Suppose your company plans to save a portion of their monthly revenue over the next 5 years, according to the chart below: Year Monthly 4 3500 2000 2500 3000 4000 Deposit You expect to earn a small rate of interest compounded annually on the account. At the end of each year (after any interest is earned), if the account balance is at least $30000, you withdraw $20000 to invest in a mutual fund, which will pay a higher interest rate. Write a function that calculates the total amount of money that you will have after 5 years, with two inputs--the interest rate for your savings account and the interest rate for the mutual fund. Test your function for an interest rate of 3% on the cash account and an interest rate of 8% on the money in the mutual fund. How much total cash will you have (including the cash account and the mutual fund investment)? To get full credit, you must use a loop structure for this problem.

Explanation / Answer

Step 1: Save the following code in a file named invest.m


%cashRate is the rate of interest for cash account
%fundRate is the rate of interest for mutual fund
function amount = invest ( cashRate, fundRate)
amount = 0;
fund = 0;
deposits = [2000; 2500; 3000; 3500; 4000];

years = length(deposits);
for i = 1 : years
amount = amount + deposits(i) * 12;
%add interest
interest = amount * cashRate / 100;
amount = amount + interest;

%add mutual fund interest
interest = fund * fundRate / 100;
fund = fund + interest;


if(amount >= 30000) %can invest in mutual fund?
amount = amount - 20000;
fund = fund + 20000;
end
end

amount = amount + fund;
end


====================
Step 2: Now in command window copy paste the following lines to calculate the amount for cash rate of 3% and mutual fund rate of 8%
format bank
invest(3, 8)

======
output
ans = 201373.51


Please do rate the answer if it helped. Thank you.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote