MATH 2070U
Midterm examination
Page 3 of 7
1. [8 marks] Write in the space provided the output you would expect in an interactive M
ATLAB
session
as a result of entering the given statements.
•
For numerical values returned, assume
format short
, i.e., numerical values displayed rounded
to 5 decimal digits.
•
Where appropriate, be sure to distinguish row and column vectors.
•
If the expression fails to evaluate, write
ERROR
with a short comment explaining the error.
•
Assume the following statements have been executed, so the variables
A
,
B
,
C
, and
D
are available
in the M
ATLAB
workspace.
A = [7,4; -2,6];
B = [4,8;1,5];
C = [4,-8;7,9;6,8];
D = [-2,6,-3;-2,1,-3];
(a)
A./B.ˆ2
(a)
(b)
2
*
B
*
C
[
7
4
A = [
[ -2
6
[
4
8
B = [
[
1
5
[
4
-8
[
C = [
7
9
[
[
6
8
[ -2
6
-3 ]
D = [
[ -2
1
-3 ]
Here, we have to observe order
of operations: ^ has higher
precedence than / (division),
so we interpret this as A./(B.^2)
(rather than (A./B).^2 which has
a different numerical value).
[
7/16
1/16
A./B.^2 = [
[ -2
6/25
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]

(b)