Académique Documents
Professionnel Documents
Culture Documents
Page 1 of 13
Lecture HW2 Name: INSERT NAME HERE
Problem Statement #1: use the fprintf statement to create output table
Page 2 of 13
Lecture HW2 Name: INSERT NAME HERE
Problem Statement #2: Code the formula for A into a user written function
Page 3 of 13
Lecture HW2 Name: INSERT NAME HERE
yr annual payment
1 58630.00
2 30251.49
3 20804.86
4 16091.17
5 13270.64
Page 4 of 13
Lecture HW2 Name: INSERT NAME HERE
3.3 addendum
Based on those inputs create a table for each of the principle amounts. The rows should have
values of payment amounts that correspond to a certain number of payoff years and the
columns should correspond to certain interest rates. Use fprintf to create the tables. See the
sample output below. Create a similar table for principle amounts of [10000:5000:30000] , for
# of years given as [3:1:7], and for the same interest rates given in the example.
principle= $200000
yrs\int 5.00% 6.00% 7.00% 8.00% 9.00% 10.00%d
5 46195 47479 48778 50091 51418 52759
10 25901 27174 28476 29806 31164 32549
15 19268 20593 21959 23366 24812 26295
20 16049 17437 18879 20370 21909 23492
25 14190 15645 17162 18736 20361 22034
30 13010 14530 16117 17765 19467 21216
principle= $300000
yrs\int 5.00% 6.00% 7.00% 8.00% 9.00% 10.00%
5 69292 71219 73167 75137 77128 79139
10 38851 40760 42713 44709 46746 48824
15 28903 30889 32938 35049 37218 39442
20 24073 26155 28318 30556 32864 35238
25 21286 23468 25743 28104 30542 33050
30 19515 21795 24176 26648 29201 31824
principle= $400000
yrs\int 5.00% 6.00% 7.00% 8.00% 9.00% 10.00%
5 92390 94959 97556 100183 102837 105519
10 51802 54347 56951 59612 62328 65098
15 38537 41185 43918 46732 49624 52590
20 32097 34874 37757 40741 43819 46984
25 28381 31291 34324 37472 40723 44067
30 26021 29060 32235 35531 38935 42432
Page 5 of 13
Lecture HW2 Name: INSERT NAME HERE
principle= $500000
yrs\int 5.00% 6.00% 7.00% 8.00% 9.00% 10.00%
5 115487 118698 121945 125228 128546 131899
10 64752 67934 71189 74515 77910 81373
15 48171 51481 54897 58415 62029 65737
20 40121 43592 47196 50926 54773 58730
25 35476 39113 42905 46839 50903 55084
30 32526 36324 40293 44414 48668 5304
Page 6 of 13
Lecture HW2 Name: INSERT NAME HERE
Page 7 of 13
Lecture HW2 Name: INSERT NAME HERE
ans =
1.0472
>> tvol(1.5,2)
ans =
7.0686
>> tvol(1.5,4.5)
ans =
24.7400
>> tvol(1.5,4.6)
??? Error using ==> tvol at 9
overtop
Page 8 of 13
Lecture HW2 Name: INSERT NAME HERE
Page 9 of 13
Lecture HW2 Name: INSERT NAME HERE
Page 10 of 13
Lecture HW2 Name: INSERT NAME HERE
else th = pi;
end
else
if y > 0
theta = pi / 2;
elseif y < 0
theta = -pi / 2;
else
theta = 0;
end
end
theta = theta * 180 / pi;
r=
theta =
>> [r,theta]=pcoord(1,1)
r=
1.4142
theta =
90
>> [r,theta]=pcoord(0,1)
r=
theta =
Page 11 of 13
Lecture HW2 Name: INSERT NAME HERE
90
>> [r,theta]=pcoord(-1,1)
r=
1.4142
theta =
135
>> [r,theta]=pcoord(-1,0)
r=
theta =
180
>> [r,theta]=pcoord(-1,-1)
r=
1.4142
theta =
-135
>> [r,theta]=pcoord(0,0)
r=
theta =
Page 12 of 13
Lecture HW2 Name: INSERT NAME HERE
>> [r,theta]=pcoord(0,-1)
r=
theta =
-90
>> [r,theta]=pcoord(1,-1)
r=
1.4142
theta =
-90
Page 13 of 13