2.9: Complex Numbers
- Page ID
- 84384
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\dsum}{\displaystyle\sum\limits} \)
\( \newcommand{\dint}{\displaystyle\int\limits} \)
\( \newcommand{\dlim}{\displaystyle\lim\limits} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\(\newcommand{\longvect}{\overrightarrow}\)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\ket}[1]{\left| #1 \right>}\)
\(\newcommand{\bra}[1]{\left< #1 \right|}\)
\(\newcommand{\braket}[2]{\left< #1 \vphantom{#2} \right| \left. #2 \vphantom{#1} \right>}\)
\(\newcommand{\braopket}[3]{\left< #1 \vphantom{#2}\vphantom{#3} \right| #2 \vphantom{#1}\vphantom{#3} \left| #3 \vphantom{#1}\vphantom{#2} \right>}\)
\(\newcommand{\qmvec}[1]{\mathbf{\vec{#1}}}\)
\(\newcommand{\op}[1]{\hat{\mathbf{#1}}}\)
\(\newcommand{\expect}[1]{\langle #1 \rangle}\)
\(\newcommand{\dfn}[1]{\emph{\textbf{#1}}}\)
By Carey A. Smith
The imaginary unit number is i.
i = sqrt(-1) or i^2 = -1
In engineering, j is often used instead of i for the imaginary unit number.
In MATLAB, you can use either i or j.
Therefore, i and j should not be used as variable names. Instead, use ii or jj or another letter.
In MATLAB, 2*i can be written as 2i, 3*i as 3i, etc. Try this.
A complex number has both a real part and an imaginary part.
a = 2 + i
b = 1 - 4i
c = -2 + 3j
Solution
Add example text here.
% (1 pt) Write a MATLAB m-file script that does the following:
% (1 pt) Define this complex number:
z1 = (2 + 3i)
% (2 pts) Separate the real and imaginary parts like this:
z1_real = real(z1)
z1_imag = imag(z1)
% (1 pt) Compute the conjugate of z1 with this line of code:
z2 = conj(z1) % This changes the sign on the imaginary part
% (1 pt) Compute:
z1*conj(z1) % Note that this = square of the real part + square of the imaginary part
% (1 pt) Compute the length of this vector:
z1_length = sqrt(z1*conj(z1))
- Answer
-
z2 = conj(z1) = 2 - 3i
z1*conj(z1) = 13
z1_length = 3.6056
% (3 pts) A complex number can be plotted by letting zx = real(z1) and zy = imag(z1)
% Plot this complex number with these lines of code:
figure;
plot(z1_real,z1_imag,'*')
grid on % Draw x & y grid lines
xlim([-1,4]) % Set the minimum and maximum x values
ylim([-1,4]) % Set the minimum and maximum y values
- Answer
-
Add texts here. Do not delete this text first.
Draw a line from (0,0) to the point with the following code:
hold on % Keep whats been plotted and add to it
plot([0,z1_real],[0,z1_imag])
% [0,z1_real] = x coordinates of start and and end of the line
% [0,z1_imag] = y coordinates of start and and end of the line
Solution
Add example text here.


