MATLAB Answers

I'm doing iteration of credit card. In it, there are looping of month ,balance, and pay every month . How to plot graph with these three variable as the value changes everytime looping happen . Thanks

1 view (last 30 days)
ZULFITRI DANIAL ROSLI
ZULFITRI DANIAL ROSLI on 13 Oct 2016
Answered: George on 14 Oct 2016
if true
% code
here is the code
while balance >0 %checking the balance
if balance < monthPay
balance = balance- balance; %to avoid the value from getting negative
else
balance = balance - monthPay;
interestPaid = (Interest/1000.00)*balance;
TotalCreditLeft = balance + interestPaid;
RealPaymentMonthly = monthPay - interestPaid;
balance = TotalCreditLeft;
end
month=month+1;
TotalInterest = interestPaid + interestPaid;
fprintf('After month %d ,', month) ;
fprintf('your balance is : $ %.2f\n',balance);
fprintf('Interest Paid : $ %.2f\n',interestPaid);
fprintf('Total Debt left : $ %.2f\n',TotalCreditLeft);
fprintf('Real Payment Monthly : $ %.2f\n',RealPaymentMonthly);
fprintf('\n');
end

  0 Comments

Sign in to comment.

Answers (1)

George
George on 14 Oct 2016
Don't try and plot it everytime it changes. Store the elements in vectors and plot those at the end.

  0 Comments

Sign in to comment.

Sign in to answer this question.


Translated by