(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 14733, 432] NotebookOptionsPosition[ 13553, 389] NotebookOutlinePosition[ 13913, 405] CellTagsIndexPosition[ 13870, 402] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[{ RowBox[{"<<", "DiscreteWavelets`DiscreteWavelets`"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"fontsize", "=", "14"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"d", "=", RowBox[{"Dashing", "[", RowBox[{"{", RowBox[{".02", ",", ".02"}], "}"}], "]"}]}], ";"}]}], "Input", CellChangeTimes->{{3.4297954283125*^9, 3.429795441875*^9}, { 3.429795550390625*^9, 3.429795550828125*^9}, 3.42979558709375*^9, { 3.42979632378125*^9, 3.429796351953125*^9}, {3.42979647696875*^9, 3.429796486375*^9}, {3.43075432145448*^9, 3.4307543291102886`*^9}, { 3.43239271725*^9, 3.432392717375*^9}, {3.432977595234158*^9, 3.432977600562317*^9}, 3.4432834512309065`*^9, {3.4530676086984243`*^9, 3.453067608998856*^9}}], Cell[CellGroupData[{ Cell["Vector v", "Section", CellChangeTimes->{{3.453068308915286*^9, 3.453068312430341*^9}}], Cell[BoxData[{ RowBox[{"v", "=", RowBox[{ RowBox[{"Range", "[", "24", "]"}], "*", "2"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"h", "=", RowBox[{"SplineFilters", "[", RowBox[{"2", ",", "2"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"y", "=", RowBox[{"BWT1D1", "[", RowBox[{"v", ",", "h"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"plt0", "=", RowBox[{"ListPlot", "[", RowBox[{"v", ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"{", RowBox[{"Thick", ",", "Black", ",", RowBox[{"PointSize", "[", ".015", "]"}]}], "}"}]}], ",", RowBox[{"Ticks", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"Range", "[", "12", "]"}], "*", "2"}], ",", RowBox[{ RowBox[{"Range", "[", "4", "]"}], "*", "12"}]}], "}"}]}], ",", RowBox[{"TicksStyle", "\[Rule]", RowBox[{"Directive", "[", "fontsize", "]"}]}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", RowBox[{"36", "*", RowBox[{"Sqrt", "[", "2", "]"}]}]}], "}"}]}], ",", RowBox[{"AxesOrigin", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}]}]}], "]"}]}]}], "Input", CellChangeTimes->{{3.44719097975975*^9, 3.447191016916*^9}, 3.447191058119125*^9, {3.447191093244125*^9, 3.44719111600975*^9}, { 3.447191314541*^9, 3.447191370681625*^9}, {3.447202506587875*^9, 3.447202510369125*^9}, {3.453067016466837*^9, 3.4530670713357344`*^9}, { 3.453067597952973*^9, 3.4530676012677393`*^9}, {3.4530676555958595`*^9, 3.453067668384248*^9}, {3.4530681206946383`*^9, 3.4530681421554976`*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["Vector v Transformed using Orthogonal Daubechies D4", "Section", CellChangeTimes->{{3.453068308915286*^9, 3.453068368340736*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"h", "=", RowBox[{"Daub", "[", "4", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"y", "=", RowBox[{"WT1D1", "[", RowBox[{"v", ",", "h"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"lp", "=", RowBox[{"Take", "[", RowBox[{"y", ",", "12"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"hp", "=", RowBox[{"Drop", "[", RowBox[{"y", ",", "12"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"plt1", "=", RowBox[{"ListPlot", "[", RowBox[{"lp", ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"{", RowBox[{"Thick", ",", "Black", ",", RowBox[{"PointSize", "[", ".015", "]"}]}], "}"}]}], ",", RowBox[{"Ticks", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"Range", "[", "6", "]"}], "*", "2"}], ",", RowBox[{ RowBox[{"Range", "[", "4", "]"}], "*", "12", "*", RowBox[{"Sqrt", "[", "2", "]"}]}]}], "}"}]}], ",", RowBox[{"TicksStyle", "\[Rule]", RowBox[{"Directive", "[", "fontsize", "]"}]}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", RowBox[{"50", "*", RowBox[{"Sqrt", "[", "2", "]"}]}]}], "}"}]}], ",", RowBox[{"AxesOrigin", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}]}]}], "]"}]}]}], "Input", CellChangeTimes->{{3.447191077744125*^9, 3.447191082541*^9}, { 3.447200919275375*^9, 3.4472010771035*^9}, {3.44720347457225*^9, 3.447203492166*^9}, {3.44720352794725*^9, 3.447203541916*^9}, { 3.447208067150375*^9, 3.447208102244125*^9}, {3.447208146306625*^9, 3.447208188087875*^9}, {3.447208846041*^9, 3.44720891138475*^9}, { 3.4472089563535*^9, 3.44720896863475*^9}, {3.453067128928549*^9, 3.453067129299082*^9}, {3.453067197617318*^9, 3.453067262410486*^9}, { 3.4530674910692816`*^9, 3.453067505600176*^9}, {3.4530676865703983`*^9, 3.453067686930917*^9}, {3.4530677728945265`*^9, 3.4530677756885443`*^9}, { 3.453067895390667*^9, 3.453067911553909*^9}, 3.453068156005413*^9}] }, Open ]], Cell[CellGroupData[{ Cell["Vector v Transformed using Biorthogonal Spline Filter", "Section", CellChangeTimes->{{3.453068308915286*^9, 3.453068368340736*^9}, { 3.4530684086587105`*^9, 3.453068429198245*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"h2", "=", RowBox[{"SplineFilters", "[", RowBox[{"2", ",", "2"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"y2", "=", RowBox[{"BWT1D1", "[", RowBox[{"v", ",", "h2", ",", RowBox[{"Boundary", "\[Rule]", "Reflective"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"lp2", "=", RowBox[{"Take", "[", RowBox[{"y2", ",", "12"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"plt2", "=", RowBox[{"ListPlot", "[", RowBox[{"lp2", ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"{", RowBox[{"Thick", ",", "Blue", ",", RowBox[{"PointSize", "[", ".015", "]"}]}], "}"}]}], ",", RowBox[{"Ticks", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"Range", "[", "6", "]"}], "*", "2"}], ",", RowBox[{ RowBox[{"Range", "[", "4", "]"}], "*", "12", "*", RowBox[{"Sqrt", "[", "2", "]"}]}]}], "}"}]}], ",", RowBox[{"TicksStyle", "\[Rule]", RowBox[{"Directive", "[", "fontsize", "]"}]}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", RowBox[{"50", "*", RowBox[{"Sqrt", "[", "2", "]"}]}]}], "}"}]}], ",", RowBox[{"AxesOrigin", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}]}]}], "]"}]}]}], "Input", CellChangeTimes->{{3.447191077744125*^9, 3.447191082541*^9}, { 3.447200919275375*^9, 3.4472010771035*^9}, {3.44720347457225*^9, 3.447203492166*^9}, {3.44720352794725*^9, 3.447203541916*^9}, { 3.447208067150375*^9, 3.447208102244125*^9}, {3.447208146306625*^9, 3.447208188087875*^9}, {3.447208846041*^9, 3.44720891138475*^9}, { 3.4472089563535*^9, 3.44720896863475*^9}, {3.453067128928549*^9, 3.453067129299082*^9}, {3.4530675197705517`*^9, 3.453067523555995*^9}, 3.453067558105675*^9, {3.453067694642005*^9, 3.453067699629176*^9}, 3.4530678786966624`*^9, {3.4530679272264447`*^9, 3.453067945552797*^9}, { 3.453067983317099*^9, 3.453068004016864*^9}, 3.4530681649783154`*^9}], Cell[BoxData[ RowBox[{"GraphicsGrid", "[", RowBox[{"{", RowBox[{"{", RowBox[{"plt1", ",", "plt2"}], "}"}], "}"}], "]"}]], "Input", CellChangeTimes->{{3.4530675627523565`*^9, 3.4530675819299326`*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["Generating the Biorthogonal Spline Filters", "Section"], Cell[TextData[{ "There is a simple command in ", StyleBox["DiscreteWavelets", FontFamily->"Courier"], " that gives you access to the biorthogonal spline filters. The command is \ called ", StyleBox["SplineFilters", FontWeight->"Bold"], " and it takes two integers. The second number in the list is for the \ spline filter. These integers must be of the same parity." }], "Text", CellChangeTimes->{3.45311070266576*^9}], Cell[BoxData[ RowBox[{ RowBox[{"{", RowBox[{"h", ",", "ht"}], "}"}], "=", RowBox[{ StyleBox["SplineFilters", FontColor->GrayLevel[0.500008]], "[", RowBox[{"2", ",", "4", ",", RowBox[{"PrintInfo", "\[Rule]", "True"}]}], "]"}]}]], "Input", CellChangeTimes->{{3.4531110375072384`*^9, 3.453111064636248*^9}}], Cell["\<\ We can build and plot the moduli of the Fourier series associated with these \ filters.\ \>", "Text"], Cell[BoxData[{ RowBox[{ RowBox[{"H", "[", "w_", "]"}], ":=", RowBox[{ StyleBox["FiniteFourier", FontColor->GrayLevel[0.500008]], "[", RowBox[{"w", ",", "h", ",", RowBox[{"-", "2"}]}], "]"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Ht", "[", "w_", "]"}], ":=", RowBox[{ StyleBox["FiniteFourier", FontColor->GrayLevel[0.500008]], "[", RowBox[{"w", ",", "ht", ",", RowBox[{"-", "1"}]}], "]"}]}], ";"}]}], "Input", CellChangeTimes->{3.4531108947820096`*^9}], Cell[BoxData[ RowBox[{"H", "[", "w", "]"}]], "Input", CellChangeTimes->{{3.4531109080711184`*^9, 3.453110919036886*^9}}], Cell[BoxData[{ RowBox[{"plt1", "=", RowBox[{"Plot", "[", RowBox[{ RowBox[{"Abs", "[", RowBox[{"H", "[", "w", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"w", ",", "0", ",", "Pi"}], "}"}], ",", RowBox[{"Ticks", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", RowBox[{"Pi", "/", "2"}], ",", "Pi"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"Sqrt", "[", "2", "]"}]}], "}"}]}], "}"}]}], ",", RowBox[{"PlotStyle", "\[Rule]", "Red"}]}], "]"}]}], "\[IndentingNewLine]", RowBox[{"plt2", "=", RowBox[{"Plot", "[", RowBox[{ RowBox[{"Abs", "[", RowBox[{"Ht", "[", "w", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"w", ",", "0", ",", "Pi"}], "}"}], ",", RowBox[{"Ticks", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", RowBox[{"Pi", "/", "2"}], ",", "Pi"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"Sqrt", "[", "2", "]"}]}], "}"}]}], "}"}]}], ",", RowBox[{"PlotStyle", "\[Rule]", "Blue"}]}], "]"}]}]}], "Input", CellChangeTimes->{{3.453110948118704*^9, 3.4531109515636578`*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["CDF biorthogonal filters", "Section", CellChangeTimes->{{3.453111411164531*^9, 3.453111411745366*^9}, { 3.4531119454427853`*^9, 3.4531119724816656`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{ RowBox[{"{", RowBox[{"CDFh1", ",", "CDFh2"}], "}"}], "=", RowBox[{"CDF97", "[", "]"}]}], ";"}], "\[IndentingNewLine]"}]], "Input", CellChangeTimes->{{3.453111423472229*^9, 3.4531114474767456`*^9}, { 3.453111480734568*^9, 3.4531115023156*^9}, {3.4531116253825617`*^9, 3.453111627165125*^9}, {3.4531118561043234`*^9, 3.453111941767501*^9}, { 3.453112660921875*^9, 3.453112675859375*^9}, {3.453112707640625*^9, 3.45311270828125*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"H", "[", "w_", "]"}], ":=", RowBox[{ StyleBox["FiniteFourier", FontColor->GrayLevel[0.500008]], "[", RowBox[{"w", ",", "CDFh1", ",", RowBox[{"-", "4"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Ht", "[", "w_", "]"}], ":=", RowBox[{ StyleBox["FiniteFourier", FontColor->GrayLevel[0.500008]], "[", RowBox[{"w", ",", "CDFh2", ",", RowBox[{"-", "3"}]}], "]"}]}], ";"}]}], "Input", CellChangeTimes->{ 3.4531108947820096`*^9, {3.4531116382510653`*^9, 3.453111643799043*^9}, { 3.4531117678374014`*^9, 3.45311177796196*^9}}], Cell[BoxData[ RowBox[{"H", "[", "w", "]"}]], "Input", CellChangeTimes->{{3.4531109080711184`*^9, 3.453110919036886*^9}}], Cell[BoxData[{ RowBox[{"plt3", "=", RowBox[{"Plot", "[", RowBox[{ RowBox[{"Abs", "[", RowBox[{"H", "[", "w", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"w", ",", "0", ",", "Pi"}], "}"}], ",", RowBox[{"Ticks", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", RowBox[{"Pi", "/", "2"}], ",", "Pi"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"Sqrt", "[", "2", "]"}]}], "}"}]}], "}"}]}], ",", RowBox[{"PlotStyle", "\[Rule]", "Red"}]}], "]"}]}], "\[IndentingNewLine]", RowBox[{"plt4", "=", RowBox[{"Plot", "[", RowBox[{ RowBox[{"Abs", "[", RowBox[{"Ht", "[", "w", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"w", ",", "0", ",", "Pi"}], "}"}], ",", RowBox[{"Ticks", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", RowBox[{"Pi", "/", "2"}], ",", "Pi"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"Sqrt", "[", "2", "]"}]}], "}"}]}], "}"}]}], ",", RowBox[{"PlotStyle", "\[Rule]", "Blue"}]}], "]"}]}]}], "Input", CellChangeTimes->{{3.453110948118704*^9, 3.4531109515636578`*^9}, { 3.4531117926330557`*^9, 3.453111794305461*^9}}] }, Open ]] }, WindowSize->{1212, 679}, WindowMargins->{{Automatic, 0}, {Automatic, 0}}, Magnification->1., FrontEndVersion->"6.0 for Microsoft Windows (32-bit) (April 20, 2007)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[568, 21, 760, 16, 72, "Input"], Cell[CellGroupData[{ Cell[1353, 41, 93, 1, 71, "Section"], Cell[1449, 44, 1666, 41, 112, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[3152, 90, 136, 1, 71, "Section"], Cell[3291, 93, 2103, 50, 132, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[5431, 148, 189, 2, 71, "Section"], Cell[5623, 152, 2075, 49, 112, "Input"], Cell[7701, 203, 213, 5, 31, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[7951, 213, 61, 0, 71, "Section"], Cell[8015, 215, 431, 11, 47, "Text"], Cell[8449, 228, 331, 9, 31, "Input"], Cell[8783, 239, 111, 3, 29, "Text"], Cell[8897, 244, 519, 16, 52, "Input"], Cell[9419, 262, 122, 2, 31, "Input"], Cell[9544, 266, 1227, 36, 52, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[10808, 307, 162, 2, 71, "Section"], Cell[10973, 311, 503, 11, 52, "Input"], Cell[11479, 324, 652, 19, 52, "Input"], Cell[12134, 345, 122, 2, 31, "Input"], Cell[12259, 349, 1278, 37, 52, "Input"] }, Open ]] } ] *) (* End of internal cache information *)