fig1_31 - end The following commands are for displaying the...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% Figure 1.31 % Loan Balance program % Program computes loan balance y[k] y0 = input('Amount of loan '); I = input('Yearly Interest rate '); c = input('Monthly loan payment '); % x[n] = c y = []; % defines y as an empty vector y(1) = (1 + (I/12))*y0 - c; for n=2:360 y(n) = (1 + (I/12))*y(n-1) - c; if y(n) < 0, break, end
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: end % The following commands are for displaying the results format bank n=1:length(y); i = 1; fprintf(' \n n y[n] in dollars ') while i <= length(n) m = min([19 length(n)-i]); out = [n(i:i+m)',y(i:i+m)'] i = i + 20; fprintf('(Hit return to continue)') pause end format short e...
View Full Document

This note was uploaded on 03/24/2010 for the course CENG 4331 taught by Professor Maryrandolph-gips during the Fall '09 term at UH Clear Lake.

Ask a homework question - tutors are online