Learning Signals and Systems with Mathematica
http://library.wolfram.com/infocenter/Articles/2990
https://www.math.duke.edu//education/ccp/materials/engin/mmatutor/mmatut14.html
Basic operations on complex numbers
In this part we examine how Mathematica deals with complex numbers.
The imaginary unit is denoted by I(upper-case "eye") in Mathematica. So, to assign 5+3i to a, enter
a = 5 + 3*I
Enter the following complex numbers in your worksheet:
- a = 5 + 3i
- b = 2 - 4i
- c = - 3 + i
- d = - 2 - 4i
- Enter the following lines of Mathematica code, and describe what each of the Mathematica commands does. Check by trying with a number different from a.
- Re[a]
- Im[a]
- Abs[a]
- Conjugate[a]
The Arg function needs special attention. Enter each of the following:
- Arg[a]
- Arg[b]
- Arg[c]
- Arg[d]
What is the range of the Arg function? Describe carefully what the Arg function does. - It is often useful to consider complex numbers in their polar form (R, Theta). We can write a simple Mathematica function to do the conversion since R is just the absolute value of the complex number z and Theta is z's argument. Enter the following function:
PolarForm[z_]:= {Abs[z], Arg[z]}
Now, we can convert the complex number a from above to its polar form. The second commmand below just gives a decimal answer. Enter
ap = PolarForm[a]
N[ap]
Repeat this for b to get bp and find its decimal form. - We can write another simple Mathematica function to convert from the polar form of a complex number to its "rectangular" form: z = x + y*I. We know that x = R*cos(Theta) and y = R*sin(Theta). Enter the following function:
ComplexForm[{R_,Theta_}]:= R*Cos[Theta] + R*Sin[Theta]*I
Lets convert ap from polar form back to a normal complex number. Enter
ComplexForm[ap]
Repeat this for bp to get the original b back. - Calculate the polar form of a*b. How is the polar form of the product related to the polar forms of the factors? (Hint: Look at both the "exact" polar forms and their conversions to decimals.)
- We begin by thinking of the function f(z) = z2 as a map of one copy of the complex plane into another. Enter the following command to define a vertical line in the complex plane, then plot the segment of the line connecting the points z1=-0.5-I to z2=-0.5+I. Enter
p=-0.5
h[t_] := p + t*I
ParametricPlot[{Re[h[t]], Im[h[t]]}, {t,-1,1},
PlotRange -> {{-1, 1}, {-2, 2}},
PlotStyle -> RGBColor[0, 0, 1],
AspectRatio -> Automatic]
To see where the squaring function maps this short vertical line segment, enter the following command:
ParametricPlot[{Re[h[t]^2], Im[h[t]^2]}, {t,-1,1},
PlotRange -> {{-1, 1}, {-2, 2}},
PlotStyle -> RGBColor[1, 0, 0],
AspectRatio -> Automatic]
Experiment by making new graphs using various values of p between -1 and 1 in the definition of the vertical line. - Alter the code to see how the squaring function maps short horizontal segments.
- Mathematica has a graphics command called "CartesianMap" that shows what happens to a mesh of short horizontal and vertical line segments under a complex function. First, we must load a package containing the command. Enter:
<< Graphics`ComplexMap`
Now, enter the following to see the line segments themselves.
CartesianMap[Identity, {-1, 1}, {-2, 2}]
Now, define the squaring function and enter the command to see the image of the mesh of vertical and horizontal line segments under the squaring function. Enter:
f[z_]:= z^2
CartesianMap[f, {-1, 1}, {-2, 2}]
See if you can identify where each line segment is mapped. Why are there fewer curves than there were line segments? - Another representation option is to reduce the number of dimensions to three by plotting z=|f(x + y*I)| against (x,y). The command "Plot3D" does this. Enter the following:
Plot3D[ Abs[ f[x + y*I] ], {x, -1, 1}, {y, -1, 1} ] - For still another representation, we'll concentrate on how the squaring function maps pieces of the unit circle. First we define a function parametrizing the unit circle. Then we plot a segment of the circle. Enter:
w[t_]:= Cos[t]+Sin[t]*I
theta = Pi/4
ParametricPlot[{Re[w[t]], Im[w[t]]}, {t, 0, theta},
PlotRange -> {{-1, 1}, {-1, 1}},
PlotStyle -> RGBColor[1, 0, 0],
AspectRatio -> Automatic]
To see where the squaring function maps this circular segment, enter the following commands:
ParametricPlot[{Re[w[t]^2], Im[w[t]^2]}, {t, 0, theta},
PlotRange -> {{-1, 1}, {-1, 1}},
PlotStyle -> RGBColor[1, 0, 0],
AspectRatio -> Automatic]
Now increase theta. As you see, eventually the image starts to draw over itself.
To indicate more clearly what is going on, we'll increase the vertical component as the curve is drawn out and plot in three dimensions using "ParametricPlot3D". Enter:
p=Pi
ParametricPlot3D[{Re[w[t]^2], Im[w[t]^2], t/4}, {t, 0, p},
PlotRange->{{-1,1},{-1,1},{0,Pi/2}} ]
Now increase p from Pi to 2Pi and study the resulting plots. - Give a word description of the square function.
- Use your description to explain why every nonzero complex number has exactly two square roots. Give a geometric method of finding them, i.e., if you have located a non-zero complex number in the plane, where should you look for the square roots?
- Continuous- and discrete-time signals
- Linear time-invariant systems: properties and examples
- Time-domain representation of LTI systems by differential and difference equations
- Convolution
- Fourier series
- Continuous-time Fourier transform
- Discrete-time Fourier transform
- Lecture 09: Sampling continuous-time signals
- Lecture 10: Introduction to FIR filter design
- Project: Convolution
- Project: Spectrogram
- Project: Image processing
- Project: Design of a FIR differentiator
Graphical representations of complex functions
In this part we examine various graphical tools for representing complex functions of a complex variable. Our test function will beSignals and Systems
Department of Electrical Engineering
University of Southern Maine
University of Southern Maine
Instructor: | Professor Mariusz Jankowski |
E-mail: | mjankowski@usm.maine.edu |
Each Mathematica notebook deals with a selected course topic. The notebooks accompany the course and are used during regularly scheduled class sessions in JMC 109 (Mathematica classroom).
If you have Mathematica (or MathReader, a free product available from Wolfram Research) installed on your computer, click on the Mathematica symbol to download a file.
(Revised: 03/01/2005)
Computer projects are a required part of the course. Here is a list of recent projects:
(Revised: 05/25/2010)
MORE ...
All notebooks have been collected in a single WinZip archive. Click here to download. You should have WinZip or other compatible extractor on your system to open the archive. New users please click on the download page link to obtain a copy of the SignalPlot package. You will need it!
If you are a new Mathematica user, or would like a quick review of Mathematica basics, look at the notebooks associated with an introductory course on scientific programming ELE298.
Visit our download page for useful Mathematica code
Visit the Mathematica Courseware Catalog.
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。