% function schedule
% schedule(537.24,67912.5,4.98454,15)
function balance = schedule(pmt,principal,ann_rate, yrs)
I = ann_rate/(100*12);
months = yrs*12;
bal(1) = principal;
int = 0;
disp(' ')
disp( ' month balance interest ')
disp( '---------------------------------------')
for i = 1:months
int = int + bal(i)*I;
bal(i+1) = bal(i)*(1+I)-pmt;
disp(sprintf(' %3.0f %8.2f %6.2f',i,bal(i),int))
end