Filter löschen
Filter löschen

What code should i write for CDBal ?? (Attachment Included)

4 Ansichten (letzte 30 Tage)
Jack
Jack am 1 Nov. 2013
% filename: SavCD.m % % Purpose: a script to simulate compounded interest on a linked savings % account and certificate Deposit account(CD). Inersts rate may % differ and an investment strategy contorols transfer. % % Reference: Palm, Intro to Matlab 7 for Engr, Ch4 #41, pg.257 % % Inputs: Depo, vector, monthly deposit amount - one value for each year % , defined in script SavRate, scalar, savings interest rate, % user input, CDRate, scalar, CD interest rate, defined in script % % Outputs: SavBal, Scalar, final balance in savings account, CDBal, % scalar, final balance in all CDs' % % State Relationships: Savings interest compounded monthly, CD interest % compounded anually, at the end of each year if % savings balance in greater or equal to 3000, % transfer 2000 from savings into CD % B.Sobati % 10/31/2013
Depo = [300; 350; 350; 350; 400]; SavRate = input('Please enter saving rate>> '); CDRate = .06; SavBal = 0; CDBal = 0;
for YearDepo = 12.*Depo(:,1); SavBal = SavRate.*YearDepo + YearDepo; if SavBal >= 3000; SavBalT = SavBal - 2000; %CDBal = ??? ; else disp(['Your total saving balance is>> ',num2str(sum(SavBalT));' and Your CD balance is>> ',num2str(sum(CDBal))]) end disp(['Your total saving balance is>> ',num2str(sum(SavBalT)),' and Your CD balance is>> ',num2str(sum(CDBal))]) end

Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by