labch4.ppt

22
Trigonometry and Complex Numbers

Upload: rose-sky

Post on 07-Sep-2015

2 views

Category:

Documents


1 download

TRANSCRIPT

  • Trigonometry and Complex Numbers

  • Matlab Commands for Trigonometric Functions sin - Sine. sind - Sine of argument in degrees. sinh - Hyperbolic sine. asin - Inverse sine. asind - Inverse sine, result in degrees. asinh - Inverse hyperbolic sine. cos - Cosine. cosd - Cosine of argument in degrees. cosh - Hyperbolic cosine. acos - Inverse cosine. acosd - Inverse cosine, result in degrees. acosh - Inverse hyperbolic cosine. tan - Tangent. tand - Tangent of argument in degrees. tanh - Hyperbolic tangent. atan - Inverse tangent.

  • atand - Inverse tangent, result in degrees. atan2 - Four quadrant inverse tangent. atanh - Inverse hyperbolic tangent. sec - Secant. secd - Secant of argument in degrees. sech - Hyperbolic secant. asec - Inverse secant. asecd - Inverse secant, result in degrees. asech - Inverse hyperbolic secant. csc - Cosecant. cscd - Cosecant of argument in degrees. csch - Hyperbolic cosecant. acsc - Inverse cosecant. acscd - Inverse cosecant, result in degrees. acsch - Inverse hyperbolic cosecant. cot - Cotangent. cotd - Cotangent of argument in degrees. coth - Hyperbolic cotangent. acot - Inverse cotangent. acotd - Inverse cotangent, result in degrees. acoth - Inverse hyperbolic cotangent. hypot - Square root of sum of squares.

  • Note that care must be taken in computing an angle from an inverse trigonometric function. The functions asin and atan will yield angles only in quadrants I and IV: I for a positive argument and IV for a negative argument. The function acos yields angles only in quadrants I and II: I for a positive argument and II for a negative argument. The function atan2 is best used to compute angles, as the lengths of both the x and y sides of the triangle are used in the calculation. Consider a case for quadrant II, with x = -1, y = 1The hyperbolic functions are functions of the natural exponential function ex, where e is the base of the natural logarithms, which is approximately e = 2.71828182845904. The inverse hyperbolic functions are functions of the natural logarithm function, ln x. See page 57 for more details

  • 4.2 Complex Numbers Complex numbers find widespread applications in many fields. They are used throughout mathematics, applied science, and engineering to represent the harmonic nature of vibrating systems and oscillating fields.A powerful feature of MATLAB is that it does not require any special handling for complex numbers.

  • 4.2.1 Definitions and GeometryImaginary number: The most fundamental new concept in the study of complex numbers is the imaginary number j. This imaginary number is defined to be the square root of -1, j2 = -1.You may be more familiar with the imaginary number being denoted by i, which is the common notation in mathematics. However, in engineering, an electrical current is denoted by i, so j is used for the imaginary number.

  • Rectangular Representation: A complex number z consists of the real part x and the imaginary part y and is expressed as: z = x + jyWhere, x = Re[z]; y = Im[z]This form of representation for complex numbers is called the rectangular or Cartesian form since z can be represented in rectangular coordinates by the point (x, y) in a plane having a horizontal axis being the real axis and the vertical axis being the imaginary axis.

  • In MATLAB, i and j are variable names that default to the imaginary number. general complex number can be formed in three ways:In the first method, the imaginary number j explicitly multiplies the real number (imaginary part). In the second method, the imaginary number j is used as notation to produce an imaginary part . Note however, that j cannot precede the imaginary part. The third way is to use the matlab command complex(x,y).In MATLAB, the function real(z) returns the real part and imag(z) returns the imaginary part Try out the examples in page 59.

  • Polar Representation: Defining the radius r and the angle of the complex number z shown in the Figure above, z can be represented in polar form and written as: z = r cos+ jr sin, or in shortened notation:

    Where r is the magnitude of z which r = (x2 + y2)1/2 and = tan-1(y/x) is the angle.In Matlab the command abs(z) gives the magnitude and angle(z) gives the angle.Do example in page 60ej = cos+ j sin, this is called Eulers identity. Using this identity z can be written as z = rejTo convert from polar to rectangular representation use: x = rcos , y = r sin.

  • 4.2.2 Algebra of Complex Numbers Addition and Subtraction: The complex numbers z1 and z2 are added (or subtracted) by separately adding (or subtracting) the real and imaginary parts:z1 + z2 = (x1 + jy1) + (x2 + jy2) = (x1 + x2) + j(y1 + y2)z1 - z2 = (x1 + jy1) - (x2 + jy2) = (x1 - x2) + j(y1 - y2)Do example in page 64

  • Multiplication: Multiplication is better understood if the complex exponential representations are used: z1z2 = r1ej1r2ej2 = r1r2ej(1+ 2)We say from the above that the magnitudes multiply and the angles add.Do example in page 65.Rotation: There is a special case of complex multiplication, assume in the multiplication above that r2 is 1, then the multiplication is just a rotation of z1by an angle of 2 CCW. See figure 4.6

  • Complex Conjugate. For every complex number z = x + jy there is the complex conjugate z*= x jy , the magnitude of z and its conjugate are the same but the angle is The mathematical procedure for finding a complex conjugate is to replace j with -j , changing the sign of the imaginary part of the complex number.The Matlab command conj(z) gives the conjugate of the complex number z.The product of z and z* is the magnitude squared.Do examples in page 68.

  • Division: when dividing two complex numbers the magnitude of the quotient is the quotient of the magnitudes and the angle of the quotient is the difference of the angle of the numerator and the angle of the denominator.Do example in page 69, 72

  • Using your calculator to perform complex number operations.Your calculator can perform the following complex number operations:Addition, subtraction, multiplication, division.Argument (angle), and absolute value (magnitude) calculations.Reciprocal, square and cube calculations.Conjugate complex number calculation.We will go through pages E-42 through E-44 of the calculator manual

  • 4.3 Two-Dimensional Plotting Plotting Complex Variables The plot command can be used to plot complex variables in the complex plane. >> z = 1 + 0.5j; >> plot(z,.) This creates a graphics window, called a Figure window, named by default Figure No. 1 z plotted as a point (due to the command .) in the complex plane, with the real value (1.0) on the horizontal (x) axis and the imaginary value (0.5) on the vertical (y) axis. The axes have been scaled automatically, with a range of 0.0 to 2.0 on the horizontal axis and a range of -0.5 to 1.5 on the vertical axis.

  • 4.3.1 2D Plotting CommandsType: help graph2dColors and MarkersColor and markers can be specified by giving plot an additional argument following the complex variable name. This optional additional argument is a character string (enclosed in single quotes) consisting of characters from the table on page 74Try plotting z above with different markers and colors.

  • Customizing Plot Axes:axis([xmin xmax ymin ymax]) Define minimum and maximum values of the axes.axis square Produce a square plot instead of rectangular Equal.axis equal scaling factors for both axes.axis normal Turn off axis square, equal.axis(auto) Return the axis to automatic defaults.axis off Turn off axis background, labeling, grid, box, and tick marks. Leave the title and any labels placed by the text and gtext commands.axis on Turn on axis background, labeling, tick marks, and, if they are enabled, box and grid.

  • Adding New Curveshold on Retain existing axes, add new curves to current axes when new plot commands are issued. If the new data does not fit within the current axes limits, the axes are rescaled (for automatic scaling only.hold off Releases the current figure window for new plots.ishold Logical command that returns 1 (True) if hold is on and 0 (False) if hold is off.

  • Plot Grids, Axes Box, and Labelsgrid onAdds dashed grid lines at the tick marksgrid offRemoves grid lines (default)grid Toggles grid status (off to on, or on to off)box onAdds axes box, consisting of boundary lines and tick marks on top and right of plotbox offRemoves axes box (default)boxToggles box statustitle(text)Labels top of plot with text in quotesxlabel(text) Labels horizontal (x) axis with text in quotesylabel(text) Labels vertical (y) axis with text in quotestext(x,y,text) Adds text in quotes to location (x,y) on the current axes, where (x,y) is in units from the current plotgtext(text) Place text in quotes with mouse: displays the plot window, puts up a cross-hair to be positioned with the mouse, and write the text onto the plot at the selected position when the left mouse button or any keyboard key is pressed

  • Printing Figures and Saving Figure FilesTo print a plot using commands from the menu bar, make the Figure window the active window by clicking it with the mouse. Then select the Print menu item from the File menu. Using the parameters set in the Print Setup or Page Setup menu item, the current plot is sent to the printer.MATLAB has its own printing commands that can be executed from the Command window. To print a Figure window, click it with the mouse or use the figure(n) command, where n is the figure number, to make it active, and then execute the print command

  • The orient command changes the print orientation mode, as follows: orient portraitPrints vertically in middle of page (default) orient landscape Prints horizontally, stretches to fill the pageorient tallPrints vertically, stretches to fill the pageorientDisplays the current orientation

  • The commands compass and polar are used to plot complex quantities as vectors.