Graphics Programs Reference
In-Depth Information
format bank; disp(' Interest Rate
Payment')
for rate = 1:10,
disp([rate, double(subs(R, [A, N, J], [150000, 360,...
rate*percent*peryear]))])
end
Interest Rate
Payment
1.00
482.46
2.00
554.43
3.00
632.41
4.00
716.12
5.00
805.23
6.00
899.33
7.00
997.95
8.00
1100.65
9.00
1206.93
10.00
1316.36
Note the use of format bank to write the floating point numbers with two
digits after the decimal point.
There's another way to understand these calculations that's a little slicker
and that uses MATLAB's linear algebra capability. Namely, we can write the
fundamental equation
P new = P old m R
in matrix from as
v new = B v old ,
where v is the column vector ( 1 ) and B is the square matrix
m R
01
.
We can check this using matrix multiplication:
symsRP;B=[m-R;01];v=[P;1];B*v
ans =
[ m*P-R]
[
1]
Search WWH ::




Custom Search