Wavelet

Modelica Wavelet Library

Information


The package Wavelet is a function library developed for Modelica to carry out wavelet transform and related calculations. It is used for the post processing of the simulation results or other data. Online operation, meaning execution of the functions during the simulation process, is not possible.

The numerical calculation of wavelet transform requires that the data be sampled in equidistant time grids. If non-equidistant time grids are used, the data should be firstly converted to equidistant using function interpL in this library. If the data are to be generated by Dymola with model simulation, it is suggested that Equidistant time grid should be checked in the Simulation window through the menu Simulation/Setup.../Output/Output selection.

Most functions in this library do not check the input parameters. It is the task of the user to provide valid parameters. Upon wrong input parameters, unexpected errors might occur.

This library is developed and tested with the demo version of Dymola 2013.

List of the packages:

Detailed information is to be found in each package.

Package Description
Examples Some examples showing some functionalities of this library
MRA Wavelet application for multi-resolution analysis (MRA)
Denoising Wavelet application for denoising
Transform Wavelet transform and tightly related functions
Families Definition of wavelet families
General General purpose functions used in this library
Records Definitions for supporting graphic user interface
TypesDefinitions of enumeration values


Required libraries:

Besides the Modelica standard conform library, the following libraries are required for using this wavelet library:

* Modelica_LinearSystems2: This library is used for displaying the curves.
* Plot3D: This is used for showing the images generated by wavelet continuous transform (CWT). The library Plot3D is delivered with Dymola. In the Dymola demo version, the functionality of Plot3D seems to be limited, such that the 3D surfaces can only be displayed in a 2D manner.

License:

All files in this directory (Wavelet) and in all subdirectories, especially all files that build package "Wavelet" are released under the Modelica License 2.


Developers:

Dr. Michael Gao, michael.gao@tum.de
Mr. Qipeng Hu, qipeng.hu@gmail.com
Mr. Weihua Wang
Mr. Hanko Ipach

Acknowlegement:

The development of this library is supported by EU within the project, Clean Sky, sub-project, MoMoLib, No. 296369. The first delivery of this Wavelet library is made in October 2013.


Package Content

NameDescription
Wavelet.Examples Examples Some examples to use this Wavelet Library
Wavelet.MRA MRA Application: One-dimensional multi-resolution analysis
Wavelet.Denoising Denoising Application: One dimensional signal denoising
Wavelet.Transform Transform Functions for wavelet transform
Wavelet.Families Families Functions about wavelet families
Wavelet.General General General functions
Wavelet.Records Records Records, mainly used for graphic user interface
Wavelet.Types Types Definitions of enumeration values


Wavelet.Examples

Some examples to use this Wavelet Library

Information


This section provides several examples. They serve as a starting point for the users to start their work with this library. Most examples can be accessed through a graphic interface for setting input parameters and displaying results.

To execute the examples that read simulation result data from MAT files, the two Modelica models (testSigna1 and testSignal2) have to be firstly run in Dymola, so that the MAT files are generated and stored in the hard disk.

Package Content

NameDescription
Wavelet.Examples.displayWavelet displayWavelet Display the wavelet available in this Wavelet Library
Wavelet.Examples.cwtChirpCurve cwtChirpCurve CWT of a chirp signal with outputs shown in curves
Wavelet.Examples.cwtChirpImage cwtChirpImage CWT of a chirp signal with outputs shown with curves and images
Wavelet.Examples.fileData_cwtn fileData_cwtn CWT of the simulation result read from a MAT file
Wavelet.Examples.fileDataMRA fileDataMRA MRA of the simulation result read from a MAT file
Wavelet.Examples.fileDataDenoising fileDataDenoising Denoising of the simulation result read from a MAT file
Wavelet.Examples.testSignal1 testSignal1 Generates a test signal for analysis
Wavelet.Examples.testSignal2 testSignal2 Generates a test signal for analysis


Wavelet.Examples.displayWavelet

Display the wavelet available in this Wavelet Library

Information


This example displays the wavelet and scaling functions of a wavelet family in one diagram. For a wavelet that has no scaling function, only the wavelet function is displayed. For the complex wavelets, the real and imaginary parts are displayed with two curves. The user is able to select a wavelet by its name and set its parameters through a graphic interface.

Please refer to the description of wavelet families for the detailed information about the available wavelets in this library.

Because of the length of discrete Meyer wavelet, the display of it takes a long time.

Inputs

TypeNameDefaultDescription
wavletDefinitionwp Parameters for generating wavelet and scaling functions. See wavFunc() for detailed description of the parameters.


Wavelet.Examples.cwtChirpCurve

CWT of a chirp signal with outputs shown in curves

Information


This function carries out continuous wavelet transform of a chirp signal with graphic user interface. The data to be analyzed are given as default input values in the function. Bothe the original data and the transform result are shown with curves.

Since simple default values are provided with this function, a direct execution of this function without any extra input parameters will deliver a complete MRA analysis for an example.

Refer to the description of Families for detailed information about the available wavelets.

Inputs

TypeNameDefaultDescription
Realsignal[:]{1.0000,1.0000,0.9999,0.9996...Vector, the signal to be analyzed
Realscales[:]{2,8,32}Scales
wavletDefinitionwIn Input parameters for wavelet filters and functions


Wavelet.Examples.cwtChirpImage

CWT of a chirp signal with outputs shown with curves and images

Information


This function carries out continuous wavelet transform of a chirp signal with graphic user interface. The data to be analyzed are given as default input values in the function. The original data are shown with a curve. The transform result will be shown in an image with pseudo-color. For showing this image, the 'Plot3D' library has to be available.

Since simple default values are provided with this function, a direct execution of this function without any extra input parameters will deliver a complete MRA analysis for an example.

Refer to the description of Families for detailed information about the available wavelets.

Inputs

TypeNameDefaultDescription
Realsignal[:]{1.0000,1.0000,0.9999,0.9996...Vector, the signal to be analyzed
Realscales[:]{i for i in 1:16}Scales
wavletDefinitionwIn Input parameters for wavelet filters and functions


Wavelet.Examples.fileData_cwtn

CWT of the simulation result read from a MAT file

Information


This function carries out continuous wavelet transform with graphic user interface. The data to be analyzed are to be read from the *.MAT data file that is generated by Dymola. The original data are shown in a curve. The transform result is shown in an image with pseudo-color. For showing this image, the 'Plot3D' library has to be available.

Since simple default values are provided with this function, a direct execution of this function without any extra input parameters will deliver a complete MRA analysis for an example. Due to large computational amount, this example will take some time (usually below 30 seconds) to show the transform results.

Refer to the description of Families for detailed information about the available wavelets.

Inputs

TypeNameDefaultDescription
Input data
StringfileName"testSignal2.mat"The MAT file containing the signal to be analyzed
StringsignalName"y"The signal name to be analyzed
Realt00.0Start time of the signal to be analyzed
Realt11.0End time of the signal to be analyzed
Realfs500.0Sampling frequency of the signal for analysis. This is used to generate an equidistant time grid with the expected time step. If fs == 0, the simulation time grid will be used, even if it is none-equidistant. Since wavelet analysis has to be done in equidistant time grid, non-equidistant time grids usually cause incorrect results.
Realscales[:]{i for i in 1:4:64}Scales
wavletDefinitionwIn Input parameters for wavelet filters and functions


Wavelet.Examples.fileDataMRA

MRA of the simulation result read from a MAT file

Information


This function carries out the complete wavelet MRA with graphic user interface. The data to be analyzed are to be read from the *.MAT data file that is generated by Dymola. Please note that only the wavelets of types 1, 2 and 3 are possible for MRA. Otherwise running errors will occur. The results are displayed with multiple curves. It is possible to show either the wavelet coefficients at different levels or the signals that are reconstructed with the coefficients of different single levels.

Since simple default values are provided with this function, a direct execution of this function without any extra input parameters will deliver a complete MRA analysis for an example.

Refer to the description of Families for detailed information about the available wavelets.

Inputs

TypeNameDefaultDescription
Input data
StringfileName"testSignal2.mat"The MAT file containing the signal to be analyzed
StringsignalName"y"The signal name to be analyzed
Realt00.0Start time of the signal to be analyzed
Realt11.0End time of the signal to be analyzed
Realfs200.0Sampling frequency of the signal for analysis. This is used to generate an equidistant time grid with the expected time step. If fs == 0, the simulation time grid will be used, even if it is none-equidistant. Since wavelet analysis has to be done in equidistant time grid, non-equidistant time grids usually cause incorrect results.
wavletDefinitionwd Wavelet definition. Note: Only (bi)orthogonal wavelets can be used for MRA. Valid parameters are wavID (<=7), Nd, Nr and range (dMeyer)
mraParametersmp Parameters for MRA


Wavelet.Examples.fileDataDenoising

Denoising of the simulation result read from a MAT file

Information


This function carries out denoising operation to the one-dimensional data read from a specified *.MAT file, which is a simulation database generated by Dymola. The original data, the decomposed data in different levels, the denoised data in all levels and the denoised data are displayed with diagrams. In addition, the noise that is removed from the signal is displayed in a diagram, too.

The default input values provide an example to show the functionality of this function.

Refer to the description of Families for detailed information about the available wavelets.

Inputs

TypeNameDefaultDescription
Input data
StringfileName"testSignal2.mat"The MAT file containing the signal to be analyzed
StringsignalName"y"The signal name to be analyzed
Realt00.0Start time of the signal to be analyzed
Realt11.0End time of the signal to be analyzed
Realfs200.0Sampling frequency of the signal for analysis. This is used to generate an equidistant time grid with the expected time step. If fs == 0, the simulation time grid will be used, even if it is none-equidistant. Since wavelet analysis has to be done in equidistant time grid, non-equidistant time grids usually cause incorrect results.
wavletDefinitionwd Wavelet definition. Note: Only (bi)orthogonal wavelets can be used for MRA. Valid parameters are wavID (<=7), Nd, Nr and range (dMeyer)
denoisParametersdp Data and parameters for wavelet denoising

Outputs

TypeNameDescription
Realy[:]Denoised signal
Realnoise[:]Noise removed from signal
Realc[:]Original wavelet coefficients of all levels, details see wavDec()
Realcth[:]Wavelet coefficients of all levels after applying thresholds
Integerlen[:]Lengths of coefficients for each levels, details see wavDec()


Wavelet.Examples.testSignal1

Generates a test signal for analysis

Information


This simple model generates a sum of three sinusoidal signals with different frequencies and magnitudes.

After running this model in Dymola, all simulation data are saved in testSignal1.MAT file in the hard disk.

Extends from Modelica.Blocks.Interfaces.SignalSource (Base class for continuous signal source).

Parameters

TypeNameDefaultDescription
Realoffset0Offset of output signal y
TimestartTime0Output y = offset for time < startTime [s]

Connectors

TypeNameDescription
output RealOutputyConnector of Real output signal


Wavelet.Examples.testSignal2

Generates a test signal for analysis

Information


This simple model generates a sum of sinusoidal signals with different frequencies and magnitudes.

After running this model in Dymola, all simulation data are saved in testSignal2.MAT file in the hard disk.

Extends from Modelica.Blocks.Interfaces.SignalSource (Base class for continuous signal source).

Parameters

TypeNameDefaultDescription
Realoffset0Offset of output signal y
TimestartTime0Output y = offset for time < startTime [s]

Connectors

TypeNameDescription
output RealOutputyConnector of Real output signal


Wavelet.MRA

Application: One-dimensional multi-resolution analysis

Information


The one dimensional wavelet Multi-Resolution-Analysis (MRA) toolbox is an application function group created on the wavelet transform base library. Wavelet MRA carries out an N-level wavelet decomposition to obtain the wavelet coefficients in N detail levels and one approximation level. The coefficients of every single level are then used to reconstruct the signal separately. The result is a series of signals, each of which represents a certain frequency range of the original signal. In this way, the original signal can be observed in different (N+1) resolutions.

This toolbox provides two main functions for MRA. Function mra carries out numerical calculation and outputs MRA results in a matrix. Function mraGUI provides a graphic user interface to directly display the analysis results. It provides a further possibility to show the wavelet coefficients in every singles levels.

Only orthogonal, biorthogonal and discrete Meyer wavelets are possible for MRA. Please refer to the description of wavelet families for the detailed information about the available wavelets in this library.

Package Content

NameDescription
Wavelet.MRA.mraGUI mraGUI Graphic user interface for multi-resolution analysis (MRA)
Wavelet.MRA.mra mra Wavelet multi-resolution analysis (MRA)Graphic user interface for multi-resolution analysis (MRA)
Wavelet.MRA.tuneCoef tuneCoef Tune the wavelet coefficients of all decomposition levels


Wavelet.MRA.mraGUI

Graphic user interface for multi-resolution analysis (MRA)

Information


This function carries out the complete wavelet MRA with graphic user interface. Please note that only the wavelets of types 1, 2 and 3 are possible for MRA. Otherwise running errors will occur. The results are displayed with multiple curves. It is possible to show either the wavelet coefficients at different levels or the signals that are reconstructed with the coefficients of different single levels.

Since simple default values are provided with this function, a direct execution of this function without any extra input parameters will deliver a complete MRA analysis for an example.

Refer to the description of Families for detailed information about the available wavelets.

Inputs

TypeNameDefaultDescription
Input data
Realu[:]{0.9594,3.6278,7.6766,8.3415...Signal to be analyzed
wavletDefinitionwd Wavelet definition. Note: Only (bi)orthogonal wavelets can be used for MRA. Valid parameters are wavID (<=7), Nd, Nr and range (dMeyer)
mraParametersmp Parameters for MRA


Wavelet.MRA.mra

Wavelet multi-resolution analysis (MRA)Graphic user interface for multi-resolution analysis (MRA)

Information


This function carries out the complete wavelet MRA and outputs decomposed signals in all levels after coefficient tuning. Please note that only the wavelets of types 1 (orthogonal), 2 (bi-orthogonal) and 3 (discrete Meyer) are possible for MRA. Otherwise running errors will occur.

Since default values are provided with this function, a direct execution of this function without extra input parameters will deliver a simple example.

Refer to the description of Families for detailed information about the available wavelets.

Inputs

TypeNameDefaultDescription
Input data
Realu[:]{0.9594,3.6278,7.6766,8.3415...Signal to be analyzed
wavletDefinitionwd Wavelet definition. Note: Only (bi)orthogonal wavelets can be used for MRA. Valid parameters are wavID (<=7), Nd, Nr and range (dMeyer)
mraParametersmp Parameters for MRA

Outputs

TypeNameDescription
Realy[:, :]Reconstructed signals with tuned coefficients in all levels. y[1,:] -- reconstructed signal, y[2,:] -- 1st detail level, y[3,:] -- 2nd detail level, ..., y[N+1,:] -- N-th detail level, y[N+2,:] -- approximation level, where N is the number of the decomposition levels.


Wavelet.MRA.tuneCoef

Tune the wavelet coefficients of all decomposition levels

Information


This function supports wavelet MRA. After wavelet (multi-level) decomposition, the coefficients are usually tuned in order to change the signal magnitude at different levels. This function is able to freely change the magnitude of the coefficients at each level by multiplying them with a given factor, which could be any real value.

The definition of c[:] and len[:] are the same as in the function wavDec().

Inputs

TypeNameDefaultDescription
Realc0[:]{-0.707,-0.707,-0.707,-0.706...Original wavelet coefficients of all levels
Integerlen[:]{13,7,4,2,2}Lengths of wavelet coefficients for each levels
Realratio[:]{1,0.1,2,-1}{rD1, rD2, ..., rDN, rAN}, tuning factors of all levels.

Outputs

TypeNameDescription
Realc1[size(c0, 1)]Tuned wavelet coefficients of all levels


Wavelet.Denoising

Application: One dimensional signal denoising

Information


The wavelet denoising toolbox is an application function group created on the wavelet transform base library. Wavelet denoising is based on the consideration that the noise energy in the data is significantly lower than the signal energy, or the part of the data that contains useful information. In this case, the noise is mainly represented with the wavelet coefficients that have small magnitudes. If these coefficients are removed (set to be zeros) and the signal is reconstructed, the noise will be eliminated from the original data. Therefore, wavelet denoising is only suitable for the cases where the signal-to-noise ratio is high.

The thresholds to decide which coefficients are to be removed are usually empirically determined based on the data to be analyzed. However, there are methods (the function thSelect) to automatically select the thresholds by analyzing the input data if the noise has normal distribution property. It has to be noted that the thresholds calculated by thSelect in this toolbox are valid only if the noise has normal (Gaussian) distribution with zero mean and standard deviation of one! Otherwise, the data have to be pre-conditioned or the thresholds have to be manually selected by the user.

The same data processing for denoising could also be used for data compression. The idea is based on such consideration: The wavelet coefficients with small magnitudes contain little information about the original signal. By removing these coefficients, the data amount can be greatly reduced while not much information is lost. If a suitable wavelet is used, most coefficients might have very small magnitudes. Thus, a large compression ratio can be achieved.

Only orthogonal, biorthogonal or discrete Meyer wavelets can be used for wavelet denoising.

Package Content

NameDescription
Wavelet.Denoising.denoisGUI denoisGUI Graphic user interface for 1D wavelet denoising
Wavelet.Denoising.denois denois 1D wavelet denoising
Wavelet.Denoising.thSelect thSelect Calculates threshold value for denoising
Wavelet.Denoising.thApply thApply Apply soft or hard thresholding


Wavelet.Denoising.denoisGUI

Graphic user interface for 1D wavelet denoising

Information


This function is a modified version of the function denois. It provides graphic user interface (GUI) for parameter input and displaying denoising results. Instead of filter banks, the wavelet is specified with its name. The original data, the decomposed data in different levels, the denoised data in all levels and the denoised data are displayed with diagrams. In addition, the noise that is removed from the signal is displayed in a diagram, too.

The default input values provide an example to show the functionality of this function.

Inputs

TypeNameDefaultDescription
Input data
Realu[:]{-1.3853,1.5788,2.2041,3.982...Signal to be analyzed
wavletDefinitionwd Wavelet definition. Note: Only (bi)orthogonal wavelets can be used for MRA. Valid parameters are wavID (<=7), Nd, Nr and range (dMeyer)
denoisParametersdp Data and parameters for wavelet denoising

Outputs

TypeNameDescription
Realy[:]Denoised signal
Realnoise[:]Noise removed from signal
Realc[:]Original wavelet coefficients of all levels, details see wavDec()
Realcth[:]Wavelet coefficients of all levels after applying thresholds
Integerlen[:]Lengths of coefficients for each levels, details see wavDec()


Wavelet.Denoising.denois

1D wavelet denoising

Information


This function carries out the wavelet denoising calculation for a data. The wavelet filter bank must be available for calling this function. This has to be obtained by wavelet filter functions.

It has to be noted that the thresholds calculated by thSelect in this toolbox are valid only if the noise has normal (Gaussian) distribution with zero mean and standard deviation of one! Otherwise, the data have to be pre-conditioned or the thresholds have to be manually selected by the user.

The manual selection of the thresholds has the possibility that the thresholds for the levels can be different. The thresholds are given in the input parameter, th[:], each element of which is used for one level. If a threshold for a level is less than zero, the default threshold automatically calculated by thSelect will be used.

Inputs

TypeNameDefaultDescription
Realu[:]{-1.3853,1.5788,2.2041,3.982...Data to be denoised
IntegerdecLevel2Wavelet decomposition levels
Reallod[:]{0.7071067811865476,0.707106...Wavelet low pass filter for decomposition
Realhid[:]{-0.7071067811865476,0.70710...Wavelet high pass filter for decomposition
Reallor[:]{0.7071067811865476,0.707106...Wavelet low pass filter for reconstruction
Realhir[:]{0.7071067811865476,-0.70710...Wavelet high pass filter for reconstruction
Realth[:]{-1,-1}Thresholds for all decomposition levels with th[1] for the first detail level (highest frequency components)
BooleansorhtrueSoft (false) or hard (true) thresholding for all decomposition levels
threshMethodthMethod1Method for automatic threshold calculation

Outputs

TypeNameDescription
Realy[:]Denoised data
Realnoise[:]Noise removed from the data, = u-y
Realc[:]Wavelet coefficients before denoising
Realcth[:]Wavelet coefficients after denoising
Integerlen[:]Length of wavelet coefficients of all levels


Wavelet.Denoising.thSelect

Calculates threshold value for denoising

Information


This function analyzes the input data and calculates a common threshold for wavelet denoising for all detail levels using the specified methods. Four methods are available:

1. Fixed form: The threshold is calculated as sqrt(2*log(size(u,1))).

2. SURE: The threshold is calculated based on Stein's Unbiased Risk Estimate (SURE) of risk, which is a quadratic loss function.

3. Heuristic SURE: This is a heuristic version of the SURE method. It is actually a combination of the first two methods. For the signal with strong noises, the fixed form method is used. Otherwise, SURE method id used.

4. Minimal maximum: The threshold is estimated to realize the minimum of the maximum mean square error of the observed data. This method is derived from statistic theory.

It has to be noted that the thresholds calculated by thSelect in this toolbox are valid only if the noise has normal (Gaussian) distribution with zero mean and standard deviation of one! Otherwise, it is recommended that the data are to be pre-conditioned or the thresholds be manually selected.

Inputs

TypeNameDefaultDescription
Realu[:]{-1.3853,1.5788,2.2041,3.982...Signal vector
threshMethodthID1Threshold calculation method

Outputs

TypeNameDescription
RealthThreshold value


Wavelet.Denoising.thApply

Apply soft or hard thresholding

Inputs

TypeNameDefaultDescription
Realu[:]{0,1,2,3,4,5,6,7,8,9}Input vector
Realth5Threshold value
BooleansorhtrueSoft (false) or hard (true) thresholding

Outputs

TypeNameDescription
Realy[:]Vector after thresholding


Wavelet.Transform

Functions for wavelet transform

Information


This library includes the following one-dimensional wavelet transforms and inverse transforms:

1. Continuous wavelet transform: cwt() and cwtn();

2. Discrete wavelet transform: dwt();

3. Inverse discrete wavelet transform: idwt();

4. Multi-level wavelet decomposition: wavDec();

5. Multi-level wavelet reconstruction: wavRec();

6. Single level reconstruction based on multi-level wavelet coefficients: wavRec1();

Package Content

NameDescription
Wavelet.Transform.cwt cwt One-dimensional continuous wavelet transform with a given wavelet function
Wavelet.Transform.cwtn cwtn One-dimensional continuous wavelet transform with a given wavelet name
Wavelet.Transform.dwt dwt One-dimensional discrete wavelet transform (one-level decomposition)
Wavelet.Transform.idwt idwt One-dimensional inverse discrete wavelet transform (one-level reconstruction)
Wavelet.Transform.wavDec wavDec Wavelet multilevel decomposition
Wavelet.Transform.wavRec wavRec Wavelet multilevel reconstruction
Wavelet.Transform.wavRec1 wavRec1 Wavelet reconstruction using coefficients from a single level
Wavelet.Transform.wavCoef1 wavCoef1 Extract the wavelet coefficients of a single level


Wavelet.Transform.cwt

One-dimensional continuous wavelet transform with a given wavelet function

Information


One-dimensional CWT transforms a vector to a two dimensional image. The first dimension (horizontal axis) is the same as the original data. The second dimension (vertical axis) is the scale, similar to frequency. The scales are defined by the input parameter, scales. Larger scale values correspond to lower frequencies.

Refer to the section of wavelet Families for the detailed information about the available wavelets.

The default input values provide a quick example with a simple saw-tooth signal.

Inputs

TypeNameDefaultDescription
Realu[:]{1.0000,1.0000,0.9999,0.9996...Signal to be analyzed
Realscales[:]{1,4,16}Scales to be transformed
Realw[:]{1,-1}Wavelet function for the transform
Realx_w[:]{0,1}Regular grid of the wavelet function

Outputs

TypeNameDescription
Realcoefs[size(scales, 1), size(u, 1)]A two dimensional matrix of wavelet coefficients. Each column corresponds to one element of the input parameter, scales.


Wavelet.Transform.cwtn

One-dimensional continuous wavelet transform with a given wavelet name

Information


This function carries out one-dimensional CWT transform, same as the function, cwt(). The only difference is that cwtn() receives the wavelet name as input.

Refer to the section of wavelet Families for the detailed information about the available wavelets.

The default input values provide a quick example with a simple saw-tooth signal.

Inputs

TypeNameDefaultDescription
Input data
Realu[:]{1.0000,1.0000,0.9999,0.9996...Signal to be analyzed
Realscales[:]{1,4,16}Scales for the transformation
wavletDefinitionwIn Wavelet definition

Outputs

TypeNameDescription
Realcoefs[size(scales, 1), size(u, 1)]A two dimensional matrix of wavelet coefficients. Each column corresponds to one element of the input parameter, scales.


Wavelet.Transform.dwt

One-dimensional discrete wavelet transform (one-level decomposition)

Information


This function calculates discrete wavelet transform (one-level wavelet decomposition) of the input signal, u. Before transformation, the original signal is extended at both ends with zero padding. The length of the two result vectors is floor((size(u,1)+size(lod,1)-1)/2).

Refer to the section of wavelet Families for the detailed information about the available wavelets.

The default input values provide a quick example with a simple saw-tooth signal.

Inputs

TypeNameDefaultDescription
Realu[:]{1,2,1,2,1,2,3,4,1}Signal to be analyzed
Reallod[:]{0.707,0.707}Low pass filter for decomposition
Realhid[size(lod, 1)]{-0.707,0.707}High pass filter for decomposition

Outputs

TypeNameDescription
Realca[:]Approximation coefficients, size(ca,1) = ceil(size(u,1)/2)
Realcd[size(ca, 1)]Detail coefficients


Wavelet.Transform.idwt

One-dimensional inverse discrete wavelet transform (one-level reconstruction)

Information


This function calculates inverse discrete wavelet transform (one-level wavelet reconstruction) using the input approximation and detail wavelet coefficients, ca and cd. The coefficient vectors are extended at both ends with zero padding before calculation. The length of the reconstructed data is usually (but not always) equal to the length of the original signal if the length is not specified.

Refer to the section of wavelet Families for the detailed information about the available wavelets.

The default input values provide a quick example to generate a simple saw-tooth signal.

Inputs

TypeNameDefaultDescription
Realca[:]{2.121,2.121,2.121,4.95,0.707}Approximation coefficients
Realcd[size(ca, 1)]{-0.707,-0.707,-0.707,-0.707...Detail coefficients
Reallor[:]{0.707,0.707}Low pass filter for reconstruction
Realhir[size(lor, 1)]{0.707,-0.707}High pass filter for reconstruction
Integerny0Length of the result, y (the central part will be extracted). If ny == 0, size(y,1) = 2*size(ca,1) - size(lor,1) +2

Outputs

TypeNameDescription
Realy[:]Reconstructed signal


Wavelet.Transform.wavDec

Wavelet multilevel decomposition

Information


This function carries out multi-level wavelet decomposition.

Parameter, len, is a vector with (N+2) elements, where N is the number of levels. It contents the length information of the coefficients in all levels. len[1] is the length of the original signal vector; len[2] is the length of the detail coefficient vector of the first decomposition level; len[3] is the length of the detail coefficient vector of the second decomposition level; and so forth. Finally, len[N+2] contains the length of the approximation coefficient vector. Parameter, c, contains the wavelet coefficients of all levels, firstly the first detail level, then the second detail level and so on, and finally the approximation coefficients. This is described again in detail as follows:

Definition of the outputs

Data Length Location
Original signal len[1] u
First level detail coefficients len[2] c[1 : len[2]]
Second level detail coefficients len[3] c[len[2]+1 : len[2]+len[3]]
... ... ...
k-th level detail coefficients len[k+1] c[sum(len[2:k])+1 : sum(len[2:k+1])]
... ... ...
N-th level detail coefficients len[N+1] c[sum(len[2:N])+1 : sum(len[2:N+1])]
Approximation coefficients len[N+2] c[sum(len[2:N+1])+1 : sum(len[2:N+2])]

Refer to the section of wavelet Families for the detailed information about the available wavelets.

The default input values provide a quick example with a simple saw-tooth signal.

Inputs

TypeNameDefaultDescription
Realu[:]{1,2,1,2,1,2,3,4,1,2,3,4,1}Signal to be analyzed
IntegerN3Decomposition level
Reallod[:]{0.707,0.707}Low pass filter for decomposition
Realhid[size(lod, 1)]{-0.707,0.707}High pass filter for decomposition

Outputs

TypeNameDescription
Realc[:]Detail and approximation coefficients. For data structure see the information section
Integerlen[N + 2]Lengths of the coefficient vectors of all levels. For data structure see the information section


Wavelet.Transform.wavRec

Wavelet multilevel reconstruction

Information


This function transforms the wavelet coefficients, which are obtained with multi-level wavelet decomposition, back to the original signal. The definitions of the input parameters, c and len, are same as the function wavDec().

Refer to the section of wavelet Families for the detailed information about the available wavelets.

The default input values provide a quick example to generate a simple saw-tooth signal.

Inputs

TypeNameDefaultDescription
Realc[:]{-0.707,-0.707,-0.707,-0.706...Detail and approximation coefficients. For data structure see the information section
Integerlen[:]{13,7,4,2,2}Coefficient vector lengths of all levels. For data structure see the information section
Reallor[:]{0.707,0.707}Low pass filter for reconstruction
Realhir[size(lor, 1)]{0.707,-0.707}High pass filter for reconstruction

Outputs

TypeNameDescription
Realu[:]Reconstructed signal


Wavelet.Transform.wavRec1

Wavelet reconstruction using coefficients from a single level

Information


This function carries out a modified wavelet reconstruction: It reconstructs the signal with the wavelet coefficients from only one single level. All other coefficients are set zero. This operation is useful for some wavelet analysis, e.g. multi-resolution analysis and wavelet de-noising.

The definitions of input parameters, c and len, are same as the function wavDec().

Refer to the section of wavelet Families for the detailed information about the available wavelets.

The default input values provide a quick example.

Inputs

TypeNameDefaultDescription
Realc[:]{-0.707,-0.707,-0.707,-0.706...Wavelet coefficients of all levels
Integerlen[:]{13,7,4,2,2}Lengths of coefficients of all levels
Reallor[:]{0.707,0.707}Low pass filter for reconstruction
Realhir[size(lor, 1)]{0.707,-0.707}High pass filter for reconstruction
Integerlevel2The level to be reconstructed. 1..N are for the detail levels, where N is the maximum decomposition level. 1 stands for the most detail level (highest frequency). N+1 is for the approximation level.

Outputs

TypeNameDescription
Realy[:]Reconstructed signal


Wavelet.Transform.wavCoef1

Extract the wavelet coefficients of a single level

Information


This function extracts the coefficients of a specified decomposition level from the data structure of the wavelet coefficients. This operation is useful if only the coefficients of a specific level are interested.

The definitions of the input parameters, c and len, are same as the function wavDec().

Refer to the section of wavelet Families for the detailed information about the available wavelets.

The default input values provide a quick example.

Inputs

TypeNameDefaultDescription
Realc[:]{-0.707,-0.707,-0.707,-0.706...Wavelet coefficients of all levels
Integerlen[:]{13,7,4,2,2}Lengths of coefficient vectors for all levels
Integerlevel2The level to be reconstructed. 1..N are for the detail levels, where N is the maximum decomposition level. 1 stands for the most detail level (highest frequency). N+1 is for the approximation level.

Outputs

TypeNameDescription
Realc1[:]Extracted coefficients


Wavelet.Families

Functions about wavelet families

Information


This section defines all available wavelets in this library. Since different wavelets have different properties, the functions for different wavelets require different input parameters and generate different output data. All available wavelets in this library with the parameters are listed in the following table.

Parameter, Nd, specifies the wavelet order. Nr is only used for biorthogonal wavelets, where Nd is for decomposition and Nr for reconstruction.

For the wavelets with theoretically unlimited support, e.g. Meyer, Gaussian, etc., the function range is set as effective support, [-es, es], if 'range' is not specified (==0).

Parameters, fb and fc, are used for some complex wavelets. These are the so-called frequency parameters defining the oscillation properties of the wavelets.

'phi' stands for scaling function, and 'psi' for wavelet function. A biorthogonal wavelet has two scaling and wavelet functions. The first function set is for forward transformation (decomposition); the second set is for inverse transformation (reconstruction).

Symbol, O, means the corresponding parameter is applicable, - not applicable, for a specific wavelet.

For generating Meyer wavelets, an external C-function saved in fft_c.c file has to be called. This C-file has to be available in the current working directory or the searching path of Modelica must include the directory of fft_c.c file.

Applicable parameters of the wavelet families

Wavelet wavID wavType Nd Nr es range fb fc phi1 psi1 phi2 psi2
Haar 1 1 - - - - - - O O - -
Daubechies 2 1 1..20 - - - - - O O - -
Symlets 3 1 1..20 - - - - - O O - -
Coiflets 4 1 1..5 - - - - - O O - -
Biorthogonal spline 5 2 1..6 1..9 - - - - O O O O
Reverse biorthogonal spline 6 2 1..9 1..6 - - - - O O O O
Discrete Meyer 7 3 -- 8 >=0 - - O O - -
Meyer 8 3 - - 8 >=0 - - O O - -
Gaussian 9 4 1..8 -5 >=0 - - - O - -
Mexican hat 10 4 - -5 >=0 - - - O - -
Morlet 11 4 - -4 >=0 - - - O - -
Complex Gaussian 12 5 1..8-5 >=0 - - - O - -
Complex Morlet 13 5 - -4 >=0 >0 >0 - O - -
Complex Shannon 14 5 - -20 >=0 >0 >0 - O - -
Complex frequency B-spline 15 5 1,2,...- 20 >=0 >0 >0 - O - -

Available orders for biorthogonal and reverse biorthogonal wavelets

For biorthogonal and reverse biorthogonal wavelets, only some combinations of the orders are available. For details, refer to the functions, wavBiorSpline and wavRevBiorSpline.

Wavelet types

All wavelets are categorized into five types. They are defined as follows:

Type Description
1 Orthogonal wavelets
2 Biorthogonal wavelets
3 Non-(bi)orthogonal wavelets with scaling function
4 Non-(bi)orthogonal wavelets without scaling function
5 Complex wavelets (without scaling function)

Package Content

NameDescription
Wavelet.Families.wavFunc wavFunc Returns the filter bank and functions of a specific wavelet family
Wavelet.Families.scalingWaveFunc scalingWaveFunc Generate the scaling and wavelet functions using wavelet filters
Wavelet.Families.wavHaar wavHaar Haar wavelet filters
Wavelet.Families.wavDaubechies wavDaubechies Daubechies wavelet filters
Wavelet.Families.wavSymlets wavSymlets Symlets wavelet filters
Wavelet.Families.wavCoiflets wavCoiflets Coiflets wavelet filters
Wavelet.Families.wavBiorSpline wavBiorSpline Biorthogonal spline wavelet filters
Wavelet.Families.wavRevBiorSpline wavRevBiorSpline Reverse biorthogonal spline wavelet filters
Wavelet.Families.wavDMeyer wavDMeyer Discrete Meyer wavelet filters
Wavelet.Families.wavMeyer wavMeyer Meyer wavelet function. The fft_c.c file must be accessible.
Wavelet.Families.wavGaussian wavGaussian Gaussian wavelet function
Wavelet.Families.wavMexHat wavMexHat Mexican hat wavelet function
Wavelet.Families.wavMorlet wavMorlet Morlet wavelet function
Wavelet.Families.wavXGaussian wavXGaussian Complex Gaussian wavelet function
Wavelet.Families.wavXMorlet wavXMorlet Complex Morlet wavelet function
Wavelet.Families.wavXShannon wavXShannon Complex Shannon wavelet function
Wavelet.Families.wavXFreqBSpline wavXFreqBSpline Complex Frequency B-Spline wavelet


Wavelet.Families.wavFunc

Returns the filter bank and functions of a specific wavelet family

Information


This function provides a common entry to access all available wavelets in this library. Since different wavelet families require different parameters and return different results, suitable input parameters must be provided. Not applicable parameters for a specific wavelet are omitted by the function.

Refer to Wavelet Families for detailed information about the available wavelets.

Inputs

TypeNameDefaultDescription
wavletDefinitionwIn Input parameters for wavelet filters and functions

Outputs

TypeNameDescription
wavFuncOutwOutOutput data of the function wavFunc()


Wavelet.Families.scalingWaveFunc

Generate the scaling and wavelet functions using wavelet filters

Information


The total length of the functions is (size(lof,1)-1)*2^iteration+1. The function support (non-zero part) is (2^iteration -1)*nf-2^iteration+2, shorter than total length. One 'zero' is then added at the beginning and multiple 'zeros' are added at the end.

Inputs

TypeNameDefaultDescription
wavletIDwavID1Id-Number of the wavelet. Necessary only for discrete Meyer wavelet
Reallof[:]{0.707,0.707}Wavelet low pass filter
Realhif[:]{-0.707,0.707}Wavelet high pass filter
Integeriteration6Iteration of the calculations for generating the functions

Outputs

TypeNameDescription
Realx[:]Equidistant grid of the functions
Realphi[:]The scaling function
Realpsi[:]The wavelet function


Wavelet.Families.wavHaar

Haar wavelet filters

Information


This function generate the Haar wavelet filter bank. No input parameters are required.

Outputs

TypeNameDescription
RealF[:]Scaling filter
Reallod[:]High pass filter for decomposition
Realhid[:]Low pass filter for decomposition
Reallor[:]High pass filter for reconstruction
Realhir[:]Low pass filter for reconstruction


Wavelet.Families.wavDaubechies

Daubechies wavelet filters

Information


This function generate the Daubechies wavelet filter banks for the orders up to 10. If a wrong order number is given, an empty vector is returned.

Inputs

TypeNameDefaultDescription
Integerorder2Order of the wavelet. order<=10

Outputs

TypeNameDescription
RealF[:]Scaling filter
Reallod[:]High pass filter for decomposition
Realhid[:]Low pass filter for decomposition
Reallor[:]High pass filter for reconstruction
Realhir[:]Low pass filter for reconstruction


Wavelet.Families.wavSymlets

Symlets wavelet filters

Information


This function generate the Symlets wavelet filter banks for the orders up to 8. If a wrong order number is given, an empty vector is returned.

Inputs

TypeNameDefaultDescription
Integerorder2Order of the wavelet. order<=8

Outputs

TypeNameDescription
RealF[:]Scaling filter
Reallod[:]High pass filter for decomposition
Realhid[:]Low pass filter for decomposition
Reallor[:]High pass filter for reconstruction
Realhir[:]Low pass filter for reconstruction


Wavelet.Families.wavCoiflets

Coiflets wavelet filters

Information


This function generate the Coiflets wavelet filter banks for the orders up to 5. If a wrong order number is given, an empty vector is returned.

Inputs

TypeNameDefaultDescription
Integerorder2Order of the wavelet. order<=5

Outputs

TypeNameDescription
RealF[:]Scaling filter
Reallod[:]High pass filter for decomposition
Realhid[:]Low pass filter for decomposition
Reallor[:]High pass filter for reconstruction
Realhir[:]Low pass filter for reconstruction


Wavelet.Families.wavBiorSpline

Biorthogonal spline wavelet filters

Information


This function generates the biorthogonal spline wavelet filters, where Nr is the order of the reconstruction filters, and Nd the order of the decomposition filters.

Usually, lodFd and hidFr are used for decomposition, and lorFr and hirFd are used for reconstruction.

Available orders of biorthogonal wavelet filters

Nd Nr
1, 3, 5 1
2, 4, 6, 8 2
1, 3, 5, 7, 9 3
4 4
5 5
8 6

Inputs

TypeNameDefaultDescription
IntegerNd2Wavelet order for decomposition
IntegerNr2Wavelet order for reconstruction

Outputs

TypeNameDescription
RealFd[:]Scaling filter for decomposition
ReallodFd[:]High pass filter for decomposition using filter Fd
RealhidFd[:]Low pass filter for decomposition using filter Fd
ReallorFd[:]High pass filter for reconstruction using filter Fd
RealhirFd[:]Low pass filter for reconstruction using filter Fd
RealFr[:]Scaling filter for reconstruction
ReallodFr[:]High pass filter for decomposition using filter Fr
RealhidFr[:]Low pass filter for decomposition using filter Fr
ReallorFr[:]High pass filter for reconstruction using filter Fr
RealhirFr[:]Low pass filter for reconstruction using filter Fr


Wavelet.Families.wavRevBiorSpline

Reverse biorthogonal spline wavelet filters

Information


This function generates the biorthogonal spline wavelet filters, where Nr is the order of the reconstruction filters, and Nd the order of the decomposition filters.

Usually, lodFd and hidFr are used for decomposition, and lorFr and hirFd are used for reconstruction.

Available orders of biorthogonal wavelet filters

Nd Nr
1 1, 3, 5
2 2, 4, 6, 8
3 1, 3, 5, 7, 9
4 4
5 5
6 8

Inputs

TypeNameDefaultDescription
IntegerNd2Wavelet order for decomposition
IntegerNr2Wavelet order for reconstruction

Outputs

TypeNameDescription
RealFd[:]Scaling filter for decomposition
ReallodFd[:]High pass filter for decomposition using filter Fd
RealhidFd[:]Low pass filter for decomposition using filter Fd
ReallorFd[:]High pass filter for reconstruction using filter Fd
RealhirFd[:]Low pass filter for reconstruction using filter Fd
RealFr[:]Scaling filter for reconstruction
ReallodFr[:]High pass filter for decomposition using filter Fr
RealhidFr[:]Low pass filter for decomposition using filter Fr
ReallorFr[:]High pass filter for reconstruction using filter Fr
RealhirFr[:]Low pass filter for reconstruction using filter Fr


Wavelet.Families.wavDMeyer

Discrete Meyer wavelet filters

Information


This function returns the filter bank of discrete Meyer wavelet, which is an approximation of continuous Meyer wavelet. The filters with the length of 102 points usually provide sufficient accuracy. However, such long filters might cause long calculation time. Therefore, this function provides the possibility to return shorter filters. The trade-off is lower accuracy. Please note that some lengths will cause significantly large errors. The default length is 22.

Inputs

TypeNameDefaultDescription
Integerpoints22Filter length (<= 102). The complete length is used if this variable is <= 0

Outputs

TypeNameDescription
RealF[:]Scaling filter
Reallod[:]High pass filter for decomposition
Realhid[:]Low pass filter for decomposition
Reallor[:]High pass filter for reconstruction
Realhir[:]Low pass filter for reconstruction


Wavelet.Families.wavMeyer

Meyer wavelet function. The fft_c.c file must be accessible.

Information


This function generates the continuous Meyer wavelet and scaling functions. Since Meyer wavelet has theoretically unlimited support, the function range has to be defined with [low, high].

For generating Meyer wavelets, an external C-function saved in fft_c.c file has to be called. This C-file has to be available in the current working directory or the searching path of Modelica must include the directory of fft_c.c file.

Inputs

TypeNameDefaultDescription
Reallow-8Lower boundary of the function
Realhigh8Higher boundary of the function
Integerpoints32Number of data points of the returned functions

Outputs

TypeNameDescription
Realx[points]Regular grid
Realphi[points]Scaling function
Realpsi[points]Wavelet function


Wavelet.Families.wavGaussian

Gaussian wavelet function

Information


This function generates the continuous Gaussian wavelet function with the order up to 8. It has no scaling function. Since Gaussian wavelet has theoretically unlimited support, the function range has to be defined with [low, high].

Inputs

TypeNameDefaultDescription
Reallow-5Lower boundary of the function
Realhigh5Higher boundary of the function
Integerorder1Order of the derivative, <=8
Integerpoints32Number of data points of the returned functions

Outputs

TypeNameDescription
Realx[points]Regular grid
Realpsi[points]Wavelet function


Wavelet.Families.wavMexHat

Mexican hat wavelet function

Information


This function generates the continuous Mexican Hat wavelet function. It has no scaling function. Since Mexican Hat wavelet has theoretically unlimited support, the function range has to be defined with [low, high].

Inputs

TypeNameDefaultDescription
Reallow-5Lower boundary of the returned function
Realhigh5Higher boundary of the returned function
Integerpoints32Number of the data points of the returned function

Outputs

TypeNameDescription
Realx[points]Regular grid
Realpsi[points]The wavelet function


Wavelet.Families.wavMorlet

Morlet wavelet function

Information


This function generates the continuous Morlet wavelet function. It has no scaling function. Since Morlet wavelet has theoretically unlimited support, the function range has to be defined with [low, high].

Inputs

TypeNameDefaultDescription
Reallow-4Lower boundary of the function
Realhigh4Higher boundary of the function
Integerpoints32Integer number, length of the returned functions

Outputs

TypeNameDescription
Realx[points]Regular grid
Realpsi[points]Wavelet function


Wavelet.Families.wavXGaussian

Complex Gaussian wavelet function

Information


This function generates the complex Gaussian wavelet function with the order up to 8. It has no scaling function. Since complex Gaussian wavelet has theoretically unlimited support, the function range has to be defined with [low, high].

Inputs

TypeNameDefaultDescription
Reallow-5Lower boundary of the function
Realhigh5Higher boundary of the function
Integerorder2Order of the derivative, <=8
Integerpoints32Number of data points of the returned functions

Outputs

TypeNameDescription
Realx[points]Regular grid
Complexpsi[points]Wavelet function


Wavelet.Families.wavXMorlet

Complex Morlet wavelet function

Information


This function generates the complex Morlet wavelet function. It has no scaling function. Since complex Morlet wavelet has theoretically unlimited support, the function range has to be defined with [low, high].

Inputs

TypeNameDefaultDescription
Reallow-4Lower boundary of the function
Realhigh4Higher boundary of the function
Integerpoints32Number of data points of the returned functions
Realfb1Band width
Realfc1Center frequency, e.g. 0.1, 0.5, 1, 1.5, ...

Outputs

TypeNameDescription
Realx[points]Regular grid
Complexpsi[points]Wavelet function


Wavelet.Families.wavXShannon

Complex Shannon wavelet function

Information


This function generates the complex Shannon wavelet function. It has no scaling function. Since complex Shannon wavelet has theoretically unlimited support, the function range has to be defined with [low, high].

Inputs

TypeNameDefaultDescription
Reallow-20Lower boundary of the function
Realhigh20Higher boundary of the function
Integerpoints32Number of data points of the returned functions
Realfb1Band width, e.g. 1, 2
Realfc1Center frequency, e.g. 0.1, 0.5, 1, 1.5, ...

Outputs

TypeNameDescription
Realx[points]Regular grid
Complexpsi[points]Wavelet function


Wavelet.Families.wavXFreqBSpline

Complex Frequency B-Spline wavelet

Information


This function generates the complex Frequency B-Spline wavelet function. It has no scaling function. Since this wavelet has theoretically unlimited support, the function range has to be defined with [low, high].

Inputs

TypeNameDefaultDescription
Reallow-20Lower boundary of the wavelet function
Realhigh20Higher boundary of the wavelet function
Integerorder2Wavelet order, a natural number, 1, 2, ...
Integerpoints32Number of data points of the returned functions
Realfb1Band width
Realfc1Center frequency, a real number, e.g. 0.1, 0.5, 1, 1.5, ...

Outputs

TypeNameDescription
Realx[points]Regular grid
Complexpsi[points]Wavelet function


Wavelet.General

General functions

Information


This section defines some general functions, which are common utilities for wavelet transformation and other functions.

Package Content

NameDescription
Wavelet.General._fft _fft An external function to carry out FFT
Wavelet.General.cumSum cumSum Cumulative sum of a vector. Data type is Real.
Wavelet.General.cumSumInt cumSumInt Cumulative sum of a vector. Data type is Integer
Wavelet.General.diff diff Difference between every two adjacent elements of a vector
Wavelet.General.fft fft Fast Fourier transform
Wavelet.General.fftShift fftShift Shift zero-frequency component to center of spectrum
Wavelet.General.findIndex findIndex Find the location of a value in a monotone vector
Wavelet.General.filterBank filterBank Get the four wavelet filters based on a given scaling filter
Wavelet.General.ifft ifft Inverse fast Fourier transform
Wavelet.General.innerProduct innerProduct Inner product of two same length vectors
Wavelet.General.interpL interpL One-dimensional linear interpolation
Wavelet.General.midVector midVector Extract the middle part of a vector
Wavelet.General.nStdIfft nStdIfft Inverse non-standard 1-D fast Fourier transform
Wavelet.General.quadReverse quadReverse Quadrature mirror of a given vector
Wavelet.General.sinc sinc Sinc function
Wavelet.General.upsample upsample Up-sampling of a vector (insert a zero after every element except the last one)
Wavelet.General.wavConv wavConv Fully convolving of a data vector and a filter vector for wavelet transform


Wavelet.General._fft

An external function to carry out FFT

Inputs

TypeNameDefaultDescription
Integerdir1Calculation direction: 1 - forward; -1 - backward
Integerm3Data points = 2^m
Realx[:]{i for i in 1:8}Real part of the data
Realy[:]{0,0,0,0,0,0,0,0}Imaginary part of the data

Outputs

TypeNameDescription
Realx_out[:]Real part of the result
Realy_out[:]Imaginary part of the result


Wavelet.General.cumSum

Cumulative sum of a vector. Data type is Real.

Inputs

TypeNameDefaultDescription
Reali_v[:]{1,2,3,4}Input vector

Outputs

TypeNameDescription
Realo_v[size(i_v, 1)]Output vector


Wavelet.General.cumSumInt

Cumulative sum of a vector. Data type is Integer

Inputs

TypeNameDefaultDescription
Integeri_v[:]{1,2,3,4}Input vector

Outputs

TypeNameDescription
Integero_v[size(i_v, 1)]Output vector


Wavelet.General.diff

Difference between every two adjacent elements of a vector

Inputs

TypeNameDefaultDescription
Realin_v[:]{1,2,3,4}Input vector

Outputs

TypeNameDescription
Realout_v[size(in_v, 1) - 1]Output vector


Wavelet.General.fft

Fast Fourier transform

Inputs

TypeNameDefaultDescription
Complexx[:]{Complex(re=1, im=0),Complex...The vector to be transformed
Integern8Number of data points to be calculated

Outputs

TypeNameDescription
Complexy[size(x, 1)]The result


Wavelet.General.fftShift

Shift zero-frequency component to center of spectrum

Inputs

TypeNameDefaultDescription
Complexx[:] The vector to be shifted

Outputs

TypeNameDescription
Complexy[size(x, 1)]The shifted vector


Wavelet.General.findIndex

Find the location of a value in a monotone vector

Information


This function searches the index of the input vector, u, according to x, so that:

If x is between u[k] and u[k+1], id1 = k and id2 = k+1.

If x is equal to u[k], id1 = id2 = k.

If x is smaller than all elements of u, id1 = id2 = 0.

If x is larger than all elements of u, id1 = id2 = size(u,1)+1.

The searching method is binary search, which has high efficiency for large searching spaces.

Inputs

TypeNameDefaultDescription
Realu[:]{1,2,3,3,3,4,5,6,7,8}A monotone vector, in which u[k+1] >= u[k] for all k
Realx3The value to be located in u

Outputs

TypeNameDescription
Integerid1The largest index, id1, so that u[id1] <= x
Integerid2The smallest index, id2, so that u[id2] >= x


Wavelet.General.filterBank

Get the four wavelet filters based on a given scaling filter

Inputs

TypeNameDefaultDescription
RealF[:]{0.5,0.5}The scaling filter

Outputs

TypeNameDescription
Reallod[:]High pass filter for decomposition
Realhid[:]Low pass filter for decomposition
Reallor[:]High pass filter for reconstruction
Realhir[:]Low pass filter for reconstruction


Wavelet.General.ifft

Inverse fast Fourier transform

Inputs

TypeNameDefaultDescription
Complexx[:]{Complex(re=36, im=0),Comple...The vector to be inverse transformed
Integern8Number of data points for calculation

Outputs

TypeNameDescription
Complexy[size(x, 1)]The result


Wavelet.General.innerProduct

Inner product of two same length vectors

Inputs

TypeNameDefaultDescription
Realx1[:]{1,2,3,4}Vector 1
Realx2[size(x1, 1)]{1,2,3,4}Vector 2

Outputs

TypeNameDescription
RealyResult


Wavelet.General.interpL

One-dimensional linear interpolation

Information


This function finds the values at u1 of the linearly interpolated function of the original data pairs, u and y. Both u and u1 must be monotone, meaning, e.g. u[k]>=u[k-1]. For the elements in u1 whose values are less than u[1], the corresponding elements in y1 are set as y[1]. For the elements in u1 whose values are greater than the last value of u, the corresponding elements in y1 are set as y[end].

Inputs

TypeNameDefaultDescription
Realu[:]{1,2,3,4}The variable of the original data
Realy[size(u, 1)]{0,1,-1,2}The function of the original data
Realu1[:]{0,0.5,1,1.5,2,2.5,3,3.5,4,4...The variable of the interpolated function

Outputs

TypeNameDescription
Realy1[size(u1, 1)]The interpolated result at the variable values, u1[:]


Wavelet.General.midVector

Extract the middle part of a vector

Inputs

TypeNameDefaultDescription
Realx[:]{1,2,3,4,5,6}Original vector
Integern3Number of the vector elements to be extracted

Outputs

TypeNameDescription
Realy[:]The result vector


Wavelet.General.nStdIfft

Inverse non-standard 1-D fast Fourier transform

Inputs

TypeNameDefaultDescription
Complexxhat[:] The vector to be inverse transformed
Reallow-8Lower boundary of the function
Realhigh8Higher boundary of the function

Outputs

TypeNameDescription
Realx[size(xhat, 1)]The recovered signal
Realt[size(xhat, 1)]Time grid


Wavelet.General.quadReverse

Quadrature mirror of a given vector

Information


Changes the signs of the even index entries of the reversed input vector, x, if p is true. If p is false the same holds for odd index entries.

Inputs

TypeNameDefaultDescription
Realx[:]{1,2,3,4,5,6,7,8}Vector
BooleanptrueIf p is true, the signs of the even index entries of the reversed input vector, x, is reversed. Otherwise, odd index entries are reversed.

Outputs

TypeNameDescription
Realy[size(x, 1)]Quadrature mirrored elements of the input vector


Wavelet.General.sinc

Sinc function

Inputs

TypeNameDefaultDescription
Realxpi/2 

Outputs

TypeNameDescription
Realy 


Wavelet.General.upsample

Up-sampling of a vector (insert a zero after every element except the last one)

Inputs

TypeNameDefaultDescription
Realu[:]{1,2,3,4}Input vector

Outputs

TypeNameDescription
Realy[size(u, 1)*2 - 1]Output vector with the (double length of u) -1


Wavelet.General.wavConv

Fully convolving of a data vector and a filter vector for wavelet transform

Inputs

TypeNameDefaultDescription
Realu[:]{1,2,3,4}The data vector
Realf[:]{1,2}The filter vector

Outputs

TypeNameDescription
Realy[size(u, 1) + size(f, 1) - 1]The filtered data vector


Wavelet.Records

Records, mainly used for graphic user interface

Package Content

NameDescription
Wavelet.Records.denoisParameters denoisParameters Parameters for 1D wavelet denoising
Wavelet.Records.mraParameters mraParameters Parameters for multi-resolution analysis (MRA)
Wavelet.Records.wavFuncOut wavFuncOut Output data of function, wavFunc()
Wavelet.Records.wavletDefinition wavletDefinition Wavelet definition


Wavelet.Records.denoisParameters

Parameters for 1D wavelet denoising

Information


Parameters for carrying out wavelet denoising.

Extends from Modelica.Icons.Record (Icon for records).

Parameters

TypeNameDefaultDescription
IntegerdecLevel2Decomposition levels, <=12
threshMethodthMethod1Select what method is to be used for calculating the threshold
BooleansorhtrueSoft (false) or hard (true) thresholding method
Thresholds (>=0) for all levels
RealthD12-1Detail level 12
RealthD11-1Detail level 11
RealthD10-1Detail level 10
RealthD9-1Detail level 9
RealthD8-1Detail level 8
RealthD7-1Detail level 7
RealthD6-1Detail level 6
RealthD5-1Detail level 5
RealthD4-1Detail level 4
RealthD3-1Detail level 3
RealthD2-1Detail level 2
RealthD1-1Detail level 1


Wavelet.Records.mraParameters

Parameters for multi-resolution analysis (MRA)

Information


Parameters for carrying out wavelet multi-resolution analysis (MRA).

Extends from Modelica.Icons.Record (Icon for records).

Parameters

TypeNameDefaultDescription
Wavelet
IntegerdecLevel2Decomposition levels, <=12
mraDisplaymraData2Select what data type is to be displayed in the decomposed levels
Tuning factor of the coefficients before reconstruction. Levels higher than decLevel are omitted.
RealrA1Approximating coefficients
RealrD121Detail coefficients, level 12
RealrD111Detail coefficients, level 11
RealrD101Detail coefficients, level 10
RealrD91Detail coefficients, level 9
RealrD81Detail coefficients, level 8
RealrD71Detail coefficients, level 7
RealrD61Detail coefficients, level 6
RealrD51Detail coefficients, level 5
RealrD41Detail coefficients, level 4
RealrD31Detail coefficients, level 3
RealrD21Detail coefficients, level 2
RealrD11Detail coefficients, level 1


Wavelet.Records.wavFuncOut

Output data of function, wavFunc()

Information


Output parameters of function wavFunc().

Parameters

TypeNameDefaultDescription
Output
StringwavName Wavelet name
IntegerwavType Wavelet type: 1. orthogonal wavelets; 2. biorthogonal wavelets; 3. wavelet with scaling function; 4. wavelet without scaling function; 5. complex wavelet without scaling function
RealF1[:] Orthogonal wavelets: scaling filter; biorthogonal wavelets: scaling filter for decomposition
RealF2[:] Only for biorthogonal wavelets: scaling filter for reconstruction
Reallod[:] Low pass filter for decomposition
Realhid[:] High pass filter for decomposition
Reallor[:] Low pass filter for reconstruction
Realhir[:] High pass filter for reconstruction
Realx[:] Equidistance grid
Realphi1[:] Scaling functions
Realpsi1[:] Wavelet functions
Realphi2[:] Scaling functions, only applicable for biorthogonal wavelets
Realpsi2[:] Wavelet functions, only applicable for biorthogonal wavelets


Wavelet.Records.wavletDefinition

Wavelet definition

Information


Parameters for wavelet definition.

Refer to the section of wavelet Families for detailed information about the available wavelets.

Extends from Modelica.Icons.Record (Icon for records).

Parameters

TypeNameDefaultDescription
Input
wavletIDwavID2ID number of the wavelet family to be displayed, 1..15.
IntegerNd3Wavelet order
IntegerNr3Wavelet order for reconstruction, only used for biorthogonal wavelets
Realfb1.0Bandwidth frequency, only for complex wavelets
Realfc1.0Center frequency, only for complex wavelets
Realrange5.0Boundary of the wavelet and scaling functions, [-range, range]. Valid for wavelets with theoretically unlimited support. Effective support is used as default value if range==0
Integerrefinement6Refinement of the estimated wavelet and scaling functions. For orthogonal and biorthogonal wavelets, it stands for the iteration times to generating functions. The returned function length is (filter_length-1)*2^refinement+1. For other wavelets, the length of the returned functions is 2^refinement.


Wavelet.Types

Definitions of enumeration values

Information


Enumeration variables are defined here.

waveletID: ID numbers of wavelets

waveletID Wavelet name
1 Haar
2 Daubechies
3 Symlets
4 Coiflets
5 Biorthogonal spline
6 Reverse biorthogonal spline
7 Meyer
8 Discrete Meyer
9 Gaussian
10 Mexican hat
11 Morlet
12 Complex Gaussian
13 Complex Morlet
14 Complex Shannon
15 Complex frequency B-Spline

mraDisplay: Data type to be displayed in MRA

Value Name Description
1 coefficients Wavelet coefficients
2 signal Reconstructed signal

threshID: ID numbers of different methods for threshold calculation for denoising

Value Name Description
1 fixedForm Fixed form threshold. Threshold value = sqrt(2*ln(N)), with N being the length of the data to be denoised.
2 SURE The threshold is calculated using the principle of Stein's Unbiased Risk Estimate(SURE).
3 heurSure Heuristic SURE method. It is a combination of fixedForm and SURE methods. The noise level is firstly tested. For a high signal-to-noise ratio, SURE method is used, otherwise fixedForm method is used.
4 miniMax The threshold is calculated according to the miniMax principle, which realizes the minimum of the maximum mean square error.

Package Content

NameDescription
mraDisplay Selection of display data for MRA: 1 - wavelet coefficients; 2 - reconstructed signal
threshMethod Methods for calculating threshold for denoising: 1 - fixed form; 2 - SURE method; 3 - heuristic SURE; 4 - minimal maximum method
wavletID Definition of wavelet identifiers: 1 - Haar; 2 - Daubechies; 3 - Symlets; 4 - Coiflets; 5 - Biorthogonal spline; 6 - Reverse biorthogonal spline; 7 - Meyer; 8 - Discrete Meyer; 9 - Gaussian; 10 - Mexican hat; 11 - Morlet; 12 - Complex Gaussian; 13 - Complex Morlet; 14 - Complex Shannon; 15 - Complex frequency B-Spline


Wavelet.Types.mraDisplay

Selection of display data for MRA: 1 - wavelet coefficients; 2 - reconstructed signal


Wavelet.Types.threshMethod

Methods for calculating threshold for denoising: 1 - fixed form; 2 - SURE method; 3 - heuristic SURE; 4 - minimal maximum method


Wavelet.Types.wavletID

Definition of wavelet identifiers: 1 - Haar; 2 - Daubechies; 3 - Symlets; 4 - Coiflets; 5 - Biorthogonal spline; 6 - Reverse biorthogonal spline; 7 - Meyer; 8 - Discrete Meyer; 9 - Gaussian; 10 - Mexican hat; 11 - Morlet; 12 - Complex Gaussian; 13 - Complex Morlet; 14 - Complex Shannon; 15 - Complex frequency B-Spline


Automatically generated Tue Nov 26 14:52:03 2013.