Years = 30;
MonthlyIncome = 50000/12;
MonthlyAdjustment = 0.05/12;
LoanStudent = 25000;
LoanStudentInterest = 0.05/12;
LoanStudentPayment = 300;
LoanHigh = 1000; % ex: a credit card
LoanHighInterest = 0.1/12;
LoanHighPayment = 200;
LoanLow = 0; %Use this to buy a car
LoanLowInterest = 0.04/12;
LoanLowPayment = 400;
MortgagePayment = 500 * ones(1, Years*12);
MonthlyExpenses = MonthlyIncome * 0.25;
Savings = 0;
SavingsInterest = 0.02;
NetIncome = 0;
for Index = 1: 1 : (Years*12)
%Anything left over from your income, goes towards your saving
%If negative apply to high loan
MonthlyIncome = MonthlyIncome * (1 + MonthlyAdjustment); % use a step function (ex: mod)
% Use the the table to determine the TaxRate based on annual income
% if ((MonthlyIncome * 12) <=>
% TaxRate = .15;
% elseif (((MonthlyIncome *12) > 50000) && ((MonthlyIncome *12) <=>
% TaxRate = .25
% else
% % ...
% end
NetIncome = MonthlyIncome * (1 - TaxRate);
%Student loan
if (LoanStudent > LoanStudentPayment)
else
end
% put some logic in here to only pay the mortgage if we still have
% anythng left on it...
% NetIncome = NetIncome - MortgagePayment;
%Low interest loan
if (Index == 1 || Index == 121 || Index == 241)
LoanLow = LoanLow + (MonthlyIncome * 12 * 0.5);
end
if (LoanLow > LoanLowPayment)
else
end
%High interest loan
if (NetIncome > LoanHigh)
else
end
%Plot savings and loans against the index
end