Sie sind auf Seite 1von 22

Trigonometry and

Complex Numbers

Matlab Commands for


Trigonometric Functions

sin
sind
sinh
asin
asind
asinh
cos
cosd
cosh
acos
acosd
acosh
tan
tand
tanh
atan

- Sine.
- Sine of argument in degrees.
- Hyperbolic sine.
- Inverse sine.
- Inverse sine, result in degrees.
- Inverse hyperbolic sine.
- Cosine.
- Cosine of argument in degrees.
- Hyperbolic cosine.
- Inverse cosine.
- Inverse cosine, result in degrees.
- Inverse hyperbolic cosine.
- Tangent.
- Tangent of argument in degrees.
- Hyperbolic tangent.
- Inverse tangent.

atand
atan2
atanh
sec
secd
sech
asec
asecd
asech
csc
cscd
csch
acsc
acscd
acsch
cot
cotd
coth
acot
acotd
acoth
hypot

- Inverse tangent, result in degrees.


- Four quadrant inverse tangent.
- Inverse hyperbolic tangent.
- Secant.
- Secant of argument in degrees.
- Hyperbolic secant.
- Inverse secant.
- Inverse secant, result in degrees.
- Inverse hyperbolic secant.
- Cosecant.
- Cosecant of argument in degrees.
- Hyperbolic cosecant.
- Inverse cosecant.
- Inverse cosecant, result in degrees.
- Inverse hyperbolic cosecant.
- Cotangent.
- Cotangent of argument in degrees.
- Hyperbolic cotangent.
- Inverse cotangent.
- Inverse cotangent, result in degrees.
- Inverse hyperbolic cotangent.
- 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 = 1
The 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

Complex Numbers 4.2

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.

Definitions and 4.2.1


Geometry

Imaginary 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 + jy
Where, 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:

z r

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 60
ej = cos+ j sin, this is called Eulers identity. Using this
identity z can be written as z = rej
To convert from polar to rectangular representation use: x =
rcos , y = r sin.

Algebra of Complex 4.2.2


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 = r1ej r2ej = r1r2ej( + )
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
1

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
1.
2.

3.
4.

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.

2D Plotting 4.3.1
Commands
Type: help graph2d
Colors and Markers
Color 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 74
Try 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 Curves


hold on
Retain existing axes, add new
curves to current axes when new plot com
mands 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 Labels


grid on
Adds dashed grid lines at the tick marks
grid off
Removes grid lines (default)
grid
Toggles grid status (off to on, or on to off)
box on
Adds axes box, consisting of boundary lines and tick
marks on top and right of plot
box off
Removes axes box (default)
box Toggles box status
title(text) Labels top of plot with text in quotes
xlabel(text) Labels horizontal (x) axis with text in quotes
ylabel(text) Labels vertical (y) axis with text in quotes
text(x,y,text) Adds text in quotes to location (x,y) on the current
axes, where (x,y) is in units from the current plot
gtext(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 Files


To 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 portrait
Prints vertically in middle
of page (default)
orient landscape Prints horizontally,
stretches to fill the page
orient tall
Prints vertically, stretches to fill
the page
orient
Displays the current orientation

The commands compass and polar are used


to plot complex quantities as vectors.

Das könnte Ihnen auch gefallen