Apply wavelet decomposition.
Decompose signal in Src and place the result in Dst. State variable must be initialized with a call to WaveletInit routine.
Decompose signal in Src and place the approximation in DstApprox and the detail in DstDetail. State variable must be initialized with a call to WaveletInit routine with Level set to 1.
Example 1
Wavelet example.
uses MtxExpr, Math387, MtxVec, SignalUtils, MtxVecTee, MtxVecEdit, ndspl;
procedure TForm1.Button1Click(Sender: TObject);
var b,c: Vector;
State: TNSPWTState;
begin
Tone(b,256,5/256,0,1);
WaveletInit(b.Length,1,0,4,wtDaublet,State);
WaveletDecompose(b,c,State); //decomposition in c
WaveletReconstruct(c,b,State); //reconstruct in b
DrawIt(b,'Original signal');
DrawIt(c,'Decomposed signal');
end;
#include "MtxVecCPP.h" //MtxVecCPP.cpp must be included in the project
#include "MtxVecEdit.hpp"
#include "MtxVecTee.hpp"
#include "SignalUtils.hpp"
#include "ndspl.hpp"
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
Vector b,c;
TNSPWtState State;
Tone(b,256,5.0/256,0,1);
WaveletInit(b->Length,1,0,4,wtDaublet,State);
WaveletDecompose(b,c,State); //decomposition in c
WaveletReconstruct(c,b,State); //reconstruct in b
DrawIt(b,"Original signal"); //check that b has not changed.
DrawIt(c,"Decomposed signal");
}
using Dew.Math;
using Dew.Math.Editors;
using Dew.Math.Units;
using Dew.Signal;
using Dew.Signal.Units;
using Dew.Math.Tee;
using Dew.Signal.Tee;
private void button1_Click(object sender, EventArgs e)
{
Vector b = new Vector(0);
Vector c = new Vector(0);
TNSPWtState State = new TNSPWtState();
SignalUtils.Tone(b,256,5.0/256,0,1,false);
SignalUtils.WaveletInit(b.Length,1,0,4, TWaveletType.wtDaublet,ref State);
SignalUtils.WaveletDecompose(b,c,ref State); //decomposition in c
SignalUtils.WaveletReconstruct(c,b,ref State); //reconstruct in b
TeeChart.DrawIt(b,"Original signal",false);
TeeChart.DrawIt(c,"Decomposed signal",false);
}