(***********************************************************************
Mathematica-Compatible Notebook
This notebook can be used on any computer system with Mathematica 4.0,
MathReader 4.0, or any compatible application. The data for the notebook
starts with the line containing stars above.
To get the notebook into a Mathematica-compatible application, do one of
the following:
* Save the data starting with the line of stars above into a file
with a name ending in .nb, then open the file inside the application;
* Copy the data starting with the line of stars above to the
clipboard, then use the Paste menu command inside the application.
Data for notebooks contains only printable 7-bit ASCII and can be
sent directly in email or through ftp in text mode. Newlines can be
CR, LF or CRLF (Unix, Macintosh or MS-DOS style).
NOTE: If you modify the data for this notebook not in a Mathematica-
compatible application, you must delete the line below containing the
word CacheID, otherwise Mathematica-compatible applications may try to
use invalid cache data.
For more information on notebooks and Mathematica-compatible
applications, contact Wolfram Research:
web: http://www.wolfram.com
email: info@wolfram.com
phone: +1-217-398-0700 (U.S.)
Notebook reader applications are available free of charge from
Wolfram Research.
***********************************************************************)
(*CacheID: 232*)
(*NotebookFileLineBreakTest
NotebookFileLineBreakTest*)
(*NotebookOptionsPosition[ 6199, 198]*)
(*NotebookOutlinePosition[ 6914, 223]*)
(* CellTagsIndexPosition[ 6870, 219]*)
(*WindowFrame->Normal*)
Notebook[{
Cell[CellGroupData[{
Cell[TextData[{
"The SmoothPhase Package\n",
StyleBox["By Ted Ersek\n ersektr@navair.navy.mil",
FontSize->12]
}], "Subtitle"],
Cell[TextData[{
"The (SmoothPhase.m) package provide a function by the same name which is \
demonstrated in the cells below. Before the cells below are evaluated \
(SmoothPhase.m) should be copied to one of the folders returned by evaluating \
($Path) in the next cell. I normally put packages in the ",
Cell[BoxData[
\(TraditionalForm\`\(\(\\\)\(AddOns\)\)\\ExtraPackages\)]],
" folder."
}], "Text"],
Cell[BoxData[
\($Path\)], "Input"],
Cell["\<\
Once the package is copied to a suitable folder it can be loaded with the \
next cell.\
\>", "Text"],
Cell[BoxData[
\(<< SmoothPhase.m\)], "Input"],
Cell["The next cell shows the SmoothPhase usage message.", "Text"],
Cell[CellGroupData[{
Cell[BoxData[
\(\(?SmoothPhase\)\)], "Input"],
Cell[BoxData[
\("SmoothPhase[data] takes a list or matrix of numeric values with no \
imaginary parts and adds to or subtracts from some elements a multiple of \
Period to minimize the difference between adjacent samples. The value of \
Period is determined from the Period option and must be a numeric value with \
no imaginary part."\)], "Print"]
}, Open ]],
Cell[CellGroupData[{
Cell["The Discrete Phase of a list", "Subsection"],
Cell["\<\
The next cell shows a typical plot for the phase of a discrete signal. The \
jump from -\[Pi] to \[Pi] is typical for this type of plot.\
\>", "Text"],
Cell[BoxData[{
\(\(PhaseList = Arg[Fourier[\((Range[50]\ - 5.25)\)\^2]];\)\), "\n",
\(\(ListPlot[PhaseList];\)\)}], "Input"],
Cell["\<\
In the next cell SmoothPhase adds 2\[Pi] to certain samples and makes the \
phase more like a smooth curve. Provided the values have units of radians \
the plot below is equivalent to the earlier plot.\
\>", "Text"],
Cell[BoxData[{
\(\(SmoothPhaseList = SmoothPhase[PhaseList];\)\), "\n",
\(\(ListPlot[SmoothPhaseList];\)\)}], "Input"]
}, Open ]],
Cell[CellGroupData[{
Cell["The Discrete Phase of a matrix", "Subsection"],
Cell["\<\
The next cell shows the phase of a two dimensional signal. As in the last \
case the phase has sudden jumps between -\[Pi] and \[Pi].\
\>", "Text"],
Cell[BoxData[{
\(\(PhaseMatrix =
Arg[Fourier[
Table[\(\((x - 12)\)\^2\) \((y - 12)\)\^2, {x, 25}, {y,
25}]\ ]];\)\), "\n",
\(\(ListPlot3D[PhaseMatrix];\)\)}], "Input"],
Cell["\<\
In the next cell SmoothPhase adds to or subtracts from certain samples a \
multiple of 2\[Pi] and makes the phase more like a smooth surface. Here \
again the two plots are equivalent as long as the phase has units of radians.\
\
\>", "Text"],
Cell[BoxData[{
\(\(SmoothPhaseMatrix = SmoothPhase[PhaseMatrix];\)\), "\n",
\(\(ListPlot3D[SmoothPhaseMatrix];\)\)}], "Input"]
}, Open ]],
Cell[CellGroupData[{
Cell["The Period option", "Subsection"],
Cell["The next cell shows the usage message of Period.", "Text"],
Cell[CellGroupData[{
Cell[BoxData[
\(\(?Period\)\)], "Input"],
Cell[BoxData[
\("Period is an option for SmoothPhase that specifies the period of the \
values in the list or matrix given to SmoothPhase. The Period setting is \
typically (2 Pi) or 360."\)], "Print"]
}, Open ]],
Cell["\<\
In the next cell an example from above is considered where the phase has \
units of degrees.\
\>", "Text"],
Cell[BoxData[{
\(\(PhaseList2 =
Arg[Fourier[\((Range[50]\ - 5.25)\)\^2]]/Degree;\)\), "\n",
\(\(ListPlot[PhaseList2];\)\)}], "Input"],
Cell["\<\
By default SmoothPhase assumes the values are periodic with a period of \
2\[Pi]. SmoothPhase can assume any other period through use of the Period \
option. In the next cell the setting (Period\[Rule]360) is used and the phase \
looks like a smooth curve with values between -288\[Degree] and 0\[Degree].\
\
\>", "Text"],
Cell[BoxData[{
\(\(SmoothPhaseList2 =
SmoothPhase[PhaseList2, Period \[Rule] 360];\)\), "\n",
\(\(ListPlot[SmoothPhaseList2,
PlotRange \[Rule] {\(-360\), 0}];\)\)}], "Input"],
Cell["\<\
In the next cell 360 is added to each sample to ensure each value for phase \
is between 0 and 360. Then Mod[expr,360] is used to move the phase sample at \
360 down to 0.\
\>", "Text"],
Cell[BoxData[
\(\(ListPlot[Mod[360 + SmoothPhaseList2, 360],
PlotRange \[Rule] {0, 360}];\)\)], "Input"]
}, Open ]]
}, Open ]]
},
FrontEndVersion->"4.0 for Microsoft Windows",
ScreenRectangle->{{0, 800}, {0, 527}},
WindowSize->{714, 431},
WindowMargins->{{Automatic, 0}, {27, Automatic}},
PrintingCopies->1,
PrintingPageRange->{Automatic, Automatic}
]
(***********************************************************************
Cached data follows. If you edit this Notebook file directly, not using
Mathematica, you must remove the line containing CacheID at the top of
the file. The cache data will then be recreated when you save this file
from within Mathematica.
***********************************************************************)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[1739, 51, 138, 4, 98, "Subtitle"],
Cell[1880, 57, 414, 8, 71, "Text"],
Cell[2297, 67, 38, 1, 30, "Input"],
Cell[2338, 70, 110, 3, 33, "Text"],
Cell[2451, 75, 49, 1, 30, "Input"],
Cell[2503, 78, 66, 0, 33, "Text"],
Cell[CellGroupData[{
Cell[2594, 82, 49, 1, 30, "Input"],
Cell[2646, 85, 352, 5, 82, "Print"]
}, Open ]],
Cell[CellGroupData[{
Cell[3035, 95, 50, 0, 47, "Subsection"],
Cell[3088, 97, 160, 3, 33, "Text"],
Cell[3251, 102, 134, 2, 51, "Input"],
Cell[3388, 106, 226, 4, 52, "Text"],
Cell[3617, 112, 127, 2, 50, "Input"]
}, Open ]],
Cell[CellGroupData[{
Cell[3781, 119, 52, 0, 47, "Subsection"],
Cell[3836, 121, 158, 3, 33, "Text"],
Cell[3997, 126, 214, 5, 51, "Input"],
Cell[4214, 133, 253, 5, 52, "Text"],
Cell[4470, 140, 135, 2, 50, "Input"]
}, Open ]],
Cell[CellGroupData[{
Cell[4642, 147, 39, 0, 47, "Subsection"],
Cell[4684, 149, 64, 0, 33, "Text"],
Cell[CellGroupData[{
Cell[4773, 153, 44, 1, 30, "Input"],
Cell[4820, 156, 205, 3, 44, "Print"]
}, Open ]],
Cell[5040, 162, 116, 3, 33, "Text"],
Cell[5159, 167, 152, 3, 51, "Input"],
Cell[5314, 172, 334, 6, 71, "Text"],
Cell[5651, 180, 201, 4, 50, "Input"],
Cell[5855, 186, 196, 4, 52, "Text"],
Cell[6054, 192, 117, 2, 30, "Input"]
}, Open ]]
}, Open ]]
}
]
*)
(***********************************************************************
End of Mathematica Notebook file.
***********************************************************************)