What code should i write for CDBal ?? (Attachment Included)
조회 수: 4 (최근 30일)
이전 댓글 표시
% 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
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!