## Stephen J. Chapman

## Chapter 8

## Complex Numbers and Additional Plots - all with Video Answers

## Educators

Chapter Questions

Write a function to polar that accepts a complex number $\mathrm{c}$ and returns two output arguments containing the magnitude mag and angle theta of the complex number. The output angle should be in degrees.

Aman Gupta

Numerade Educator

Write a function to_complex that accepts two input arguments containing the magnitude mag and angle theta of the complex number in degrees and returns the complex number $c$.

Aamir Mithaiwala

Numerade Educator

In a sinusoidal steady-state ac circuit, the voltage across a passive element (see Figure 8.36 ) is given by Ohm's law:

$$

\mathbf{V}=\mathbf{I} Z

$$

where $\mathbf{V}$ is the voltage across the element, $\mathbf{I}$ is the current though the element, and $Z$ is the impedance of the element.

( FIGURE CAN'T COPY )

complex and that these complex numbers are usually specified in the form of a magnitude at a specific phase angle expressed in degrees. For example, the voltage might be $\mathbf{V}=120 \angle 30^{\circ} \mathrm{V}$.

Write a program that reads the voltage across an element and the impedance of the element and calculates the resulting current flow. The input values should be given as magnitudes and angles expressed in degrees, and the resulting answer should be in the same form. Use the function to complex from Exercise 8.2 to convert the numbers to rectangular for the actual computation of the current, and the function to polar from Exercise 8.1 to convert the answer into polar form for display.

Shareef Jackson

Numerade Educator

Two complex numbers in polar form can be multiplied by calculating the product of their amplitudes and the sum of their phases. Thus, if $\mathbf{A}_1=A_1 \angle \theta_1$ and $\mathbf{A}_2=A_2 \angle \theta_2$, then $\mathbf{A}_1 \mathbf{A}_2=A_1 A_2 \angle \theta_1+\theta_2$. Write a program that accepts two complex numbers in rectangular form and multiplies them using the preceding formula. Use the function to polar from Exercise 8.1 to convert the numbers to polar form for the multiplication and the function to complex from Exercise 8.2 to convert the answer into rectangular form for display. Compare the result with the answer calculated using MATLAB's built-in complex mathematics.

Check back soon!

Series $R L C$ Circuit Figure 8.37 shows a series $R L C$ circuit driven by a sinusoidal ac voltage source whose value is $120 \angle 0^{\circ}$ volts. The impedance of the inductor in this circuit is $Z_L=j 2 \pi f L$, where $j$ is $\sqrt{-1}, f$ is the frequency of the voltage source in hertz, and $L$ is the inductance in henrys. The impedance of the capacitor in this circuit is $Z_c=-j \frac{1}{2 \pi f C}$, where $C$ is the capacitance in farads. Assume that $R=100 \Omega, L=0.1 \mathrm{mH}$, and $C=0.25 \mathrm{nF}$.

The current I flowing in this circuit is given by Kirchhoff's voltage law to be

$$

\mathbf{I}=\frac{120 \angle 0^{\circ} \mathrm{V}}{R+j 2 \pi f L-j \frac{1}{2 \pi f C}}

$$

( FIGURE CAN'T COPY )

(a) Calculate and plot the magnitude of this current as a function of frequency as the frequency changes from $100 \mathrm{kHz}$ to $10 \mathrm{MHz}$. Plot this information on both a linear and a $\log$-linear scale. Be sure to include a title and axis labels.

(b) Calculate and plot the phase angle in degrees of this current as a function of frequency as the frequency changes from $100 \mathrm{kHz}$ to $10 \mathrm{MHz}$. Plot this information on both a linear and a log-linear scale. Be sure to include a title and axis labels.

(c) Plot both the magnitude and phase angle of the current as a function of frequency on two subplots of a single figure. Use log-linear scales.

Ekaveera Kumar

Numerade Educator

Write a function that will accept a complex number $c$, and plot that point on a Cartesian coordinate system with a circular marker. The plot should include both the $x$ and $y$ axes, plus a vector drawn from the origin to the location of $c$.

Uma Kumari

Numerade Educator

Plot the function $v(t)=10 e^{(-0.2+j \pi) t}$ for $0 \leq t \leq 10$ using the function plot $(t, v)$. What is displayed on the plot?

AG

Ankit Gupta

Numerade Educator

Plot the function $v(t)=10 e^{(-0.2+j \pi) k}$ for $0 \leq t \leq 10$ using the function plot (v). What is displayed on the plot?

AG

Ankit Gupta

Numerade Educator

Create a polar plot of the function $v(t)=10 e^{(-0.2+j \pi)}$ for $0 \leq t \leq 10$.

Subhadeepta Sahoo

Numerade Educator

The power received by a radar from a target can be calculated from the radar equation $(8.38)$.

$$

P_r=\frac{P_t G^2 \lambda^2 \sigma}{(4 \pi)^3 r^4}

$$

where $P_t$ is the transmitted power in watts, $G$ is the antenna gain (in linear units), $\lambda$ is the wavelength of the radar signal in meters, $\sigma$ is the radar cross section (RCS) of the target in square meters, $r$ is the range from the radar to the target, and $P_r$ is the received power in watts. For a given radar and target, these characteristics are

$$

\begin{array}{cc}

P_r=20 \mathrm{~kW} & G=500 \\

\lambda=3 \mathrm{~cm} & \sigma=5 \mathrm{~m}^2

\end{array}

$$

(a) Calculate and plot the power received by this radar as the target range varies from $1 \mathrm{~km}$ to $100 \mathrm{~km}$. Plot the data on both a linear scale and a semilog $x$ scale. Which of these scales seems most appropriate for this type of data?

(b) The received power from the target can be expressed in $\mathrm{dBm}$ ( $\mathrm{dB}$ with respect to a $1 \mathrm{~mW}$ reference) as:

$$

P_t(\mathrm{dBm})=10 \times \log _{10}\left(\frac{P_t}{0.001 \mathrm{~W}}\right)

$$

Plot the power received by this radar in $\mathrm{dBm}$ as the target range varies from $1 \mathrm{~km}$ to $100 \mathrm{~km}$. Plot the data on a linear scale, a semilog $x$ scale, a semilog $y$ scale, and a log-log scale. Which of these scales seems most appropriate for this type of data?

(c) The minimum target power that this radar can detect is $-80 \mathrm{dBm}$. What is the maximum range at which this radar can detect this aircraft?

Carlos Henrique De Lima

Numerade Educator

Plot the following equations for $0 \leq t \leq 6 \pi$ :

$$

\begin{aligned}

& x(t)=e^{-0.1 t} \cos t \\

& y(t)=e^{-0.1 t} \cos t \\

& z(t)=t

\end{aligned}

$$

(a) Plot the $(x, y)$ points defined by these equations. Which function is most suitable for this plot?

(b) Plot the $(x, y, z)$ points defined by these equations. Which function is most suitable for this plot?

Howard Francis

Numerade Educator

Plot the equation $f(x, y)=0$ for $0 \leq x \leq 8$ and $0 \leq y \leq 8$ :

$$

f(x, y)=e^{-0.2 x} \sin (2 y)

$$

Which function is most suitable for creating this plot?

Check back soon!

Plot the function $z=f(x, y)$ for $-2 \leq x \leq 2$ and $-2 \pi \leq y \leq 2 \pi$ where

$$

f(x, y)=e^{-0.2 x} \sin (2 y)

$$

Which function is most suitable for creating this plot?

James Kiss

Numerade Educator

Fitting a Curve to Measurements The file samples . mat contains measured data $y(t)$ taken from an experiment.

(a) Load this data and plot it in a scatter plot. What is the approximate shape of this data?

(b) Perform a least-squares fit of this data to a straight line using the techniques described in Section 5.8. Plot both the original data points and the fitted line on a single axes. How good is the fit?

(c) Perform a least-squares fit of this data to a parabola using the techniques described in Section 5.8. Plot both the original data points and the fitted line on a single axis. How good is the fit?

Cinsy Krehbiel

Numerade Educator

Plotting Orbits When a satellite orbits the Earth, the satellite's orbit will form an ellipse, with the Earth located at one of the focal points of the ellipse. The satellite's orbit can be expressed in polar coordinates as

$$

r=\frac{p}{1-\epsilon \cos \theta}

$$

where $r$ and $\theta$ are the distance and angle of the satellite from the center of the Earth, $p$ is a parameter specifying the size of the orbit, and $\boldsymbol{\epsilon}$ is a parameter representing the eccentricity of the orbit. A circular orbit has an eccentricity $\epsilon$ of 0 . An elliptical orbit has an eccentricity of $0 \leq \epsilon<1$. If $\epsilon=1$, the satellite follows a parabolic path. If $\epsilon>1$, the satellite follows a hyperbolic path and escapes from the Earth's gravitational field.

Consider a satellite with a size parameter $p=800 \mathrm{~km}$. Plot the orbit of this satellite on a polar plot if (a) $\epsilon=0$; (b) $\epsilon=0.25$; and (c) $\epsilon=0.5$. Be sure to plot the Earth itself as a filled circle at $r=0$.

Deborah Ferry

Numerade Educator

Plot the orbit specified by Equation (8.44) for $p=1000 \mathrm{~km}$ and $\epsilon=0.25$ using function ezpolar.

AG

Ankit Gupta

Numerade Educator

The following table shows the number of widgets sold by each of five representatives during the four quarters of a year. (Note that Jose did not join the company until Q2.)

$$

\begin{array}{lllll}

\hline \text { Name } & \text { Q } & \text { Q2 } & \text { Q3 } & \text { Q4 } \\

\hline \text { Jason } & 20,000 & 19,000 & 25,000 & 15,000 \\

\text { Naomi } & 16,000 & 26,000 & 21,000 & 23,000 \\

\text { Jose } & 0 & 10,000 & 18,000 & 21,000 \\

\text { Keith } & 28,000 & 21,000 & 22,000 & 18,000 \\

\text { Ankit } & 17,000 & 23,000 & 5,000 & 30,000 \\

\hline

\end{array}

$$

(a) Display the annual sales by representative in a pie chart, with the slice belonging to Naomi exploded from the pie chart. Do this for both two-dimensional and three-dimensional pie charts.

(b) Display the total annual sales by representative as a vertical bar plot.

(c) Display the total sales by quarter as a horizonal bar plot.

(d) Display the sales by quarter as a vertical bar plot, with each representative having his or her own column in each quarter.

(e) Display the sales by quarter as a three-dimensional vertical bar plot, with each representative having his or her own column in each quarter.

(f) Display the sales by quarter as a vertical bar plot, with each representative having his or her sales displayed as a part of the total sales in the quarter. (In other words, stack the contributions of each representative vertically.)

Jon Southam

Numerade Educator

Plot of the function $v(t)=10 e^{(-0.2+j \pi) t}$ for $0 \leq t \leq 10$ using function plot3, where the three dimensions to plot are the real part of the function, the imaginary part of the function, and time.

Howard Francis

Numerade Educator

Euler's Equation Euler's equation defines $e$ raised to an imaginary power in terms of sinusoidal functions as follows:

$$

e^{\beta \theta}=\cos \theta+j \sin \theta

$$

Create a two-dimensional plot of this function as $\theta$ varies from 0 to $2 \pi$. Create a three-dimensional line plot using function plot 3 as $\theta$ varies from 0 to $2 \pi$ (the three dimensions are the real part of the expression, the imaginary part of the expression, and $\theta$ ).

Tom Greenwood

Numerade Educator

Create a mesh plot, surface plot, and contour plot of the function $z=e^{x+h y}$ for the interval $-1 \leq x \leq 1$ and $-2 \pi \leq y \leq 2 \pi$. In each case, plot the real part of $z$ versus $x$ and $y$.

Abigail Martyr

Numerade Educator

Electrostatic Potential The electrostatic potential ("voltage") at a point a distance $r$ from a point charge of value $q$ is given by the equation

$$

V=\frac{1}{4 \pi \epsilon_{\mathrm{o}}} \frac{q}{r}

$$

where $V$ is in volts, $\epsilon_0$ is the permeability of free space $\left(8.85 \times 10^{-12} \mathrm{~F} / \mathrm{m}\right)$, $q$ is the charge in coulombs, and $r$ is the distance from the point charge in

meters. If $q$ is positive, the resulting potential is positive; if $q$ is negative, the resulting potential is negative. If more than one charge is present in the environment, the total potential at a point is the sum of the potentials from each individual charge.

Suppose that four charges are located in a three-dimensional space as follows:

$$

\begin{aligned}

& q_1=10^{-13} \text { coulombs at point }(1,1,0) \\

& q_2=10^{-13} \text { coulombs at point }(1,-1,0) \\

& q_3=-10^{-13} \text { coulombs at point }(-1,-1,0) \\

& q_4=10^{-13} \text { coulombs at point }(-1,1,0)

\end{aligned}

$$

Calculate the total potential due to these charges at regular points on the plane $z$ $=1$ with the bounds $(10,10,1),(10,-10,1),(-10,-10,1)$, and $(-10,10,1)$. Plot the resulting potential three times using functions surf, mesh, and contour.

Christopher Provencher

Numerade Educator

An ellipsoid of revolution is the solid analog of a two-dimensional ellipse. The equations for an ellipsoid of revolution rotated around the $x$ axis are

$$

\begin{aligned}

& x=a \cos \phi \cos \theta \\

& y=b \cos \phi \sin \theta \\

& z=b \sin \phi

\end{aligned}

$$

where $a$ is the radius along the $x$-axis and $b$ is the radius along the $y$ - and $z$-axes. Plot an ellipsoid of revolution for $a=2$ and $b=1$.

Himanshu Kushwaha

Numerade Educator

Plot a sphere of radius 2 and an ellipsoid of revolution for $a=1$ and $b=0.5$ on the same axes. Make the sphere partially transparent so that the ellipsoid can be seen inside it.

Chris Trentman

Numerade Educator