Sie sind auf Seite 1von 5

hw3

Problem 1:
withdrawals_at_start =
5
Starting Balance
500
-------
withdrawals_remaining =
4
BALANCE =
450
-------
Your withdrawal amount cannot exceed your balance!
BALANCE =
450
-------
Must withdraw a positive scalar amount!
BALANCE =
450
-------
withdrawals_remaining =
3
BALANCE =
350
-------
Must withdraw a positive scalar amount!
BALANCE =
350
-------
withdrawals_remaining =
2
BALANCE =
290
-------
withdrawals_remaining =
1
BALANCE =
250
-------
withdrawals_remaining =
0
BALANCE =
170
-------
You can only withdraw a maximum of 5 times!
BALANCE =
170
------------------------------------------
Problem 2:
threshold of 5 applied:
x1 =
0 0 8
0 7 9
9 0 11
-------
threshold of 3 applied:
x1 =
0 0 8
5 7 9
9 0 11
x2 =
4 10
7 0
0 6
-------
threshold of 6 applied:
x1 =
0 0 8
0 7 9
9 0 11
x2 =
0 10
7 0
0 0
x3 =
0 0 0 0 0 0 7 8
-------
Not enough output arguments!
-------
threshold of 4 applied:
You have too many outputs requested!
x1 =
0 10
7 0
0 6
x2 =
NaN
-------
threshold of 4 applied:
You have too many outputs requested!
x1 =
0 10
7 0
0 6
x2 =
0 0 0 0 5 6 7 8
x3 =
NaN
------------------------------------------------
Problem 3:
How many students are in the class? 3
What is the name of the student? dumb
What is his/her grade on homework #1? 15
What is his/her grade on homework #2? 20
What is his/her grade on the final exam? 25
What is the name of the student? dumber
What is his/her grade on homework #1? 8
What is his/her grade on homework #2? 7
What is his/her grade on the final exam? 9
What is the name of the student? dumbest
What is his/her grade on homework #1? 4
What is his/her grade on homework #2? 3
What is his/her grade on the final exam? 4
Averages on homework 1, homework 2, and the final, respectively:
averages =
9.0000 10.0000 12.6667
------------------------------------------------
Problem 4:
How many students are in the class? 2
What is the name of the student? star
What is his/her grade on homework #1? 99
What is his/her grade on homework #2? 98
What is his/her grade on the final exam? 100
What is the name of the student? inconsistent
What is his/her grade on homework #1? 98
What is his/her grade on homework #2? 50
What is his/her grade on the final exam? 70
Averages on homework 1, homework 2, and the final, respectively:
averages =
98.5000 74.0000 85.0000
------------------------------------------------
Problem 5:
original_array =
0 1.5708 3.1416
4.7124 0.5236 1.0472
sine function handle applied:
ans =
0 1.0000 0.0000
-1.0000 0.5000 0.8660
natural log function handle applied:
ans =
-Inf 0.4516 1.1447
1.5502 -0.6470 0.0461
handle for anonymous function that cubes inputs applied:
ans =
0 3.8758 31.0063
104.6462 0.1435 1.1484
handle for anonymous function that takes cube roots of inputs applied:
ans =
0 1.1624 1.4646
1.6765 0.8060 1.0155
--------------------------------------------------------------

Das könnte Ihnen auch gefallen