next up previous
Next: About this document ...

ESC 251 HW 3 Due: Sep. 12

For this assignment, you should hand in both a written part and a printed part. For the printed part, you should copy and paste your MATLAB commands and output into a Word (or similar) document. Set the document font to Courier New. Remove any extraneous/erroneous commands and augment your MATLAB output to clearly indicate where one problem begins and the next one begins.

1)
(2 pts) Define the following variables:

\begin{displaymath}a = 1 + 2i;\,\,b = -1+2i.\end{displaymath}

Perform the following computations in MATLAB and verify the results by hand.
a)
a^2
b)
a*b
d)
a < b
e)
a == b
2)
(1 pt) For a and b as defined in Problem 1), answer the following
a)
What is +a'+?
b)
What is +conj(a)+?
c)
Explain why a) and b) are the same.
d)
Are +a+ and +b+ complex conjugates? Why or why not?
3)
(2 pts) Give the command that will create a row vector from -1 to 1 in steps of 0.1 and store it in the variable x. What are the dimensions of x (hint: use the +size+ command)? Give the output from the following commands and explain the results. If you encounter an error, explain why the error occurs.
a)
+x(2)+
b)
+x(1:11)+
c)
+x(0:22)+
d)
+x(1:2:21)+
e)
+x(21:-1:10)+
f)
+x(1:.1:2)+
Is the last command safe to use?
4)
(4 pts) Create the matrix

\begin{displaymath}A = \left(\begin{array}{rrr} 2 & 4 & 6 \\ 3 & 6 & 9 \\
4 & 8 & 12 \end{array}\right). \end{displaymath}

Give the output of each command and explain the results. If you encounter an error, explain why the error occurs.
a)
+A(3,1)+
b)
+A(2,3)+
d)
+A(1,0)+
e)
+A(:,2)+
f)
+A(:,1:2:3)+
g)
+A(1,:)+
h)
+A(1:2,2:3)+
i)
+A'+
Define +ii = [3 1]+ and +jj = [3 2]+. Explain the output of
j)
+A(:,jj)+
k)
+A(ii,:)+
l)
+A(ii,jj)+
5)
(2 pts) Give the commands that will create the following quantities:

\begin{displaymath}D = \left(\begin{array}{rr} 2 & 4 \\ 3 & 6 \end{array}\right)...
...
f = \left(\begin{array}{r} 4 \\ 8 \\ 12 \end{array}\right).
\end{displaymath}

Now give the command that will use D, e and f to build the matrix A from Problem 4).
6)
(6 pts) Create the following vectors in MATLAB:

\begin{displaymath}w = \left(\begin{array}{r} 4 \\ 2 \\ 1 \end{array}\right); \q...
...d
z = \left(\begin{array}{r} i \\ -i \\ 3i \end{array}\right).\end{displaymath}

Can the following operations be performed? If yes, give the result and verify by hand computation. If not, completely explain why not.
a)
+x * w+
b)
+w * w+
c)
+w' * w+
d)
+y' * z+
e)
+y * z+
f)
+y * y'+
g)
+y .* w+
h)
+y .* w'+
i)
+x .* z+
j)
+x ./ y+
7)
(8 pts) Create the following quantities in MATLAB:

\begin{displaymath}A = \left(\begin{array}{rrr} -1 & 3 & 4 \\ 6 & -2 & -9 \\ 3 &...
...d
y = \left(\begin{array}{rrr} -3 & 4 & 1 \end{array}\right). \end{displaymath}

Can the following operations be performed? If yes, give the result and verify by hand computation. If not, completely explain why not.
a)
+A * x+
b)
+x * A+
c)
+A * y+
d)
+y * A+
e)
+A' * x+
f)
+A * y'+
g)
+y' * A * x+
8)
(6 pts) Create the following matrices in MATLAB:

\begin{displaymath}A = \left(\begin{array}{rrr} 0 & 0 & 1 \\ 1 & -1 & -2 \\ -1 &...
...\begin{array}{rrr} 0 & 2 & -1 \\ -3 & 0 & 1 \end{array}\right).\end{displaymath}

Can the following operations be performed? If yes, give the result and verify by hand computation. If not, completely explain why not.
a)
+A * B+
b)
+A * C+
c)
+C * A+
9)
(2 pts) Let y be defined as in Problem 6). Perform the following calculations and verify the results by hand:
a)
+z = y.^3+
b)
+z = sqrt(y.*y)+
10)
(4 pts) Let D be defined as in Problem 5). Perform the following calculations and verify by hand.
a)
+C1 = D^2+
b)
+C2 = D.^2+
Clearly explain the difference in these 2 calculations.
11)
(2 pts) EXTRA CREDIT: You know that $\displaystyle {\sqrt[3]{-1} = -1}.$ If you have MATLAB compute this, you get the following result:
                >> (-1)^(1/3)
                ans =
                    0.5000 + 0.8660i
This is correct, but probably not what you expected. Explain how MATLAB obtained this result.



next up previous
Next: About this document ...
2018-09-09