• Home
  • Textbooks
  • MATLAB Programming for Engineers
  • Complex Data, Character Data, and Additional Plot Types

MATLAB Programming for Engineers

Stephen J.Chapman

Chapter 6

Complex Data, Character Data, and Additional Plot Types - all with Video Answers

Educators


Chapter Questions

14:22

Problem 1

Figure $6.12$ shows a series $R L C$ circuit driven by a sinusoidal $A C$ 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}}}
$$
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 sub-plots of a single figure. Use log-linear scales.

Shareef Jackson
Shareef Jackson
Numerade Educator
03:09

Problem 2

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

Tom Greenwood
Tom Greenwood
Numerade Educator
01:22

Problem 3

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.

Amy Jiang
Amy Jiang
Numerade Educator
03:46

Problem 4

In a sinusoidal steady-state AC circuit, the voltage across a passive element is given by Ohm's law:
where $\mathbf{V}$ is the voltage across the element, $\mathbf{I}$ is the current through the element, and $Z$ is the impedance of the clement. Note that all three of these values are 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 $6.3$ to convert the numbers to rectangular for the actual computation of the current, and the function to polar from Exercise $6.2$ to convert the answer into polar form for display (see Figure $6.13$ ),

Varsha Aggarwal
Varsha Aggarwal
Numerade Educator
03:53

Problem 5

Write a function that will accept a complex number $c$ and plot that point oa 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 $\mathrm{c}$.

Uma Kumari
Uma Kumari
Numerade Educator
01:22

Problem 6

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

Manik Pulyani
Manik Pulyani
Numerade Educator
04:51

Problem 7

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

Kian Manafi
Kian Manafi
Numerade Educator
00:21

Problem 8

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

WZ
Wen Zheng
Numerade Educator
00:49

Problem 9

Plot of the function $v(t)=10 e^{i-02+m y}$ for $0 \leq t \leq 10$ using function piot 3 , where the three dimensions to plot are the real part of the function, the imaginary part of the function, and time.

Linh Vu
Linh Vu
Numerade Educator
02:02

Problem 10

Euler's Equation Euler's equation defines e raised to an imaginary power in terms of sinusoidal functions as follows
$$
e^{i \theta}=\cos \theta+i \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
Tom Greenwood
Numerade Educator
06:10

Problem 11

Create a mesh plot, surface plot, and contour plot of the function $z=$ $e^{x+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$.

Mukesh Tumbapo
Mukesh Tumbapo
Numerade Educator
03:29

Problem 12

Write a program that accepts an input string from the user and determines how many times a user-specified character appears within the string. (Hint - Look up the 's' option of the input function using the MATLAB Help Browser.)

James Kiss
James Kiss
Numerade Educator
09:15

Problem 13

Modify the previous program so that it determines how many times a user-specified character appears within the string without regard to the case of the character.

Brian Ketelobeter
Brian Ketelobeter
Numerade Educator
19:54

Problem 14

Write a program that accepts a string from a user with the input function, chops that string into a series of tokens, sorts the tokens into ascending order, and prints them out.

Nicole Powell
Nicole Powell
Numerade Educator
19:54

Problem 15

Write a program that accepts a series of strings from a user with the input function, sorts the strings into ascending order, and prints them out.

Nicole Powell
Nicole Powell
Numerade Educator
19:54

Problem 16

Write a program that accepts a series of strings from a user with the Input function, sorts the strings into ascending order disregarding case, and prints them out.

Nicole Powell
Nicole Powell
Numerade Educator
01:13

Problem 17

MATLAB includes functions upper and lower, which shift a string to uppercase and lowercase respectively. Create a new function called caps, which capitalizes the first letter in each word, and forces all other letters to be lowercase.

Ernest Castorena
Ernest Castorena
Numerade Educator
01:09

Problem 18

Plot the function $y=e^{-4} \sin x$ for $x$ between 0 and 2 in steps of $0.1$. Create the following plot types: $(a)$ stem plot; $(b)$ stair plot; $(c)$ bar plot; (d) compass plot. Be sure to include titles and axis labels on all plots.

Carson Merrill
Carson Merrill
Numerade Educator
00:17

Problem 19

Suppose that George, Sam, Betty, Charlie, and Suzie contributed $\$ 5 .$ $\$ 10, \$ 7, \$ 5$, and $\$ 15$ respectively to a colleague's going-away present. Create a pie chart of their contributions. What perventage of the gift was paid for by Sam?

Kayla Scholl
Kayla Scholl
Numerade Educator
01:08

Problem 20

Plot the function $f(x)=1 / \sqrt{x}$ over the range $0.1 \leq x \leq 10.0$ using function tplot. Be sure to label your plot properly.

Carson Merrill
Carson Merrill
Numerade Educator