# Daubechies wavelet - scaling and wavelet function in MATLAB

• MATLAB
• sugaku
In summary, the conversation is about trying to reproduce the daubechies basic building graph and wavelet function graph using a specific algorithm. The function [s,w] = cascade(n,cs,cw) is used, but the user is having trouble understanding how convolution takes place. The MathWorks help is recommended for assistance.

#### sugaku

Hi everybody,

I'm trying to reproduce daubechies basic building graph and daubechies wavelet function graph (φ(r)=0 if r≦0 or 3≦r). And i found this algorithm. I would appreciate if there is anybody could help me to understand the function defined below as function [s,w] = cascade(n,cs,cw). Especially how does the convolution takes place. Thank you in advance.

>%Filter coefficients for daub4 (h<->scaling, g<->wavelet)
>h = [1+sqrt(3) 3+sqrt(3) 3-sqrt(3) 1-sqrt(3)]/(4*sqrt(2));
>g = [h(4) -h(3) h(2) -h(1)];
>
>%Calculate 5 iterations of the cascade algorithm

>plot(s); %Plot scaling function
>plot(w); %Plot wavelet function

-----------------------------------------------------------
>
> s = cs;
> w = cw;
> x2(1:2:length(w)*2) = w;
> x2(2:2:end)=0;
> x(1:2:length(s)*2) = s;
> x(2:2:end)=0;
>
> for i = 1:n
>
> s = conv(x,cs);
> w = conv(x2,cs);
>
> x2(1:2:length(w)*2) = w;
> x2(2:2:end)=0;
> x(1:2:length(s)*2) = s;
> x(2:2:end)=0;
>
> end
>
>end

I understand your interest in reproducing the Daubechies wavelet function and its scaling function in MATLAB. The algorithm you have provided seems to be a cascade algorithm, which is a common method for constructing wavelet functions. In this algorithm, the convolution takes place by multiplying and summing the input signal with the filter coefficients. This process is repeated for a certain number of iterations, n, to create a more refined wavelet function.

The filter coefficients for the Daubechies wavelet function are provided in the code as h and g, where h represents the scaling coefficients and g represents the wavelet coefficients. These coefficients are used in the convolution process to generate the wavelet function and its scaling function.

I would suggest looking into the mathematical principles behind wavelet functions and convolution to better understand the algorithm. Additionally, there are various resources available online that explain the Daubechies wavelet function and its implementation in MATLAB in more detail.

I hope this helps in your understanding of the function and its implementation. Best of luck in your research.

## 1. What is a Daubechies wavelet?

A Daubechies wavelet is a mathematical function used in signal processing and data compression. It is a type of wavelet that is named after the Belgian mathematician Ingrid Daubechies.

## 2. What is scaling and wavelet function in MATLAB?

In MATLAB, scaling and wavelet functions refer to the mathematical functions used in the discrete wavelet transform (DWT). These functions are used to decompose a signal into different frequency components and analyze its time-frequency characteristics.

## 3. How do I use the Daubechies wavelet in MATLAB?

To use the Daubechies wavelet in MATLAB, you need to first load the Wavelet Toolbox. Then, you can use the command "wfilters" to access the different Daubechies wavelet filters. The "dwt" and "idwt" commands can be used to perform the discrete wavelet transform and inverse discrete wavelet transform, respectively.

## 4. What is the difference between scaling and wavelet functions?

The scaling function is a low-pass filter that captures the low-frequency components of a signal, while the wavelet function is a high-pass filter that captures the high-frequency components. Together, these functions make up the basis for the DWT, allowing for a more comprehensive analysis of a signal's frequency content.

## 5. Can the Daubechies wavelet be used for image processing?

Yes, the Daubechies wavelet can be used for image processing as it allows for a multi-resolution analysis of an image's frequency components. It can be used for tasks such as image denoising, compression, and feature extraction.