Description
1. Creating Scalar Variables Create the following variables. Each construction should be done
in one line. Make sure to use the assigned variable names.
(a) a =
5.7π
6.9
(b) b = 239 + e
5 − 2.5 × 1023
(c) c = ln(4.23) × sin−1
(0.7)
(d) z = (3 + 2j) × (4 + 5j)
2. Complex Operations Find the real part, imaginary part, magnitude, phase and complex
conjugate of z calculated in question 1e.
3. Vector and Matrix Variables Create the following variables. Make sure to use the assigned
variable names. When doing part c and d, make sure you know when to use the colon operator : ,
and when to use linspace.
(a) Create a row vector where aV ec =
3.14 15 9 26 + 0.1j
, and generate matrices A1 and A2
with repmat and concatenation respectively, where
A1 = A2 =
3.14 15 9 26 + 0.1j
3.14 15 9 26 + 0.1j
3.14 15 9 26 + 0.1j
(b) Create the column version of aV ec, with both matrix constructor operation [ ] and transpose
function in MATLAB. Name the variables bV ec1 and bV ec2 respectively.
(c) Create a row Vector cV ec where the numbers ranges from -5 to 5 in increasing order and at an
interval of 0.1 between consecutive numbers.
(d) Create a column vector dV ec where there are 100 evenly spaced points between -5 and 5. Do
not use the same operator in part c. Optional : Can you do it in one line?
(e) Create a matrix B where B =
1 + 2j 10−5
e
j2π 3 + 4j
(f) Use eye to ATTEMPT to create a 1, 000, 000 × 1, 000, 000 identity matrix.
1
(g) Use speye to create a 1, 000, 000 × 1, 000, 000 sparse identity matrix. (Suppress the output
with a semicolon)
4. Vector and Matrix Operations Using the variables made in question 3, perform the following
operations:
(a) Use magic and divide by 65 to create a 5 × 5 doubly stochastic matrix A.
(b) Create a 5 × 5 matrix, B, such that each element is drawn from standard normal distribution.
(Note: You’ll need to look up how to make it).
(c) Compute C = BA.
(d) Compute D = BA, but different from part c, perform element wise multiplication.
(e) Compute F =
1
4A3 +
1
4A2 +
1
3A +
1
6
I.
(f) Compute G = A−1
.
2