Main Content

dyaddown

Dyadic downsampling

Description

Y = dyaddown(X) downsamples even-indexed elements of X. Y contains even-index samples of X in this case. Specify X as a vector or matrix. When you specify X as a vector, the function returns a version of X downsampled by 2.

Y = dyaddown(X,EVENODD) downsamples even- or odd-indexed elements of X. Y can contain even- or odd-indexed samples of X depends on the value of EVENODD. Specify X as a vector. When you specify X as a vector, the function returns a version of X downsampled by 2.

example

Y = dyaddown(___,'type') returns a version of X obtained by suppressing columns or rows, or rows and columns of X using 'type' argument. Specify X as a matrix.

Examples

collapse all

Create a vector of data that you want to downsample.

X1 = 1:10 
X1 = 1×10

     1     2     3     4     5     6     7     8     9    10

Downsample elements with even indices.

dse = dyaddown(X1)  
dse = 1×5

     2     4     6     8    10

You can also downsample the elements in X1 by setting EVENODD to 0.

dse2 = dyaddown(X1,0)
dse2 = 1×5

     2     4     6     8    10

Downsample elements with odd indices.

dso = dyaddown(X1,1) 
dso = 1×5

     1     3     5     7     9

Create a matrix data that you want to downsample.

X = (1:3)'*(1:4)
X = 3×4

     1     2     3     4
     2     4     6     8
     3     6     9    12

Downsample columns with even indices.

dec = dyaddown(X,0,'c') 
dec = 3×2

     2     4
     4     8
     6    12

Downsample rows with odd indices.

der = dyaddown(X,1,'r') 
der = 2×4

     1     2     3     4
     3     6     9    12

Downsample rows and columns with odd indices.

dem = dyaddown(X,1,'m') 
dem = 2×2

     1     3
     3     9

Input Arguments

collapse all

Data to be downsampled, specified as a vector or matrix. X is a vector when you do not use the 'type' argument in the dyaddown function and X is a matrix when you use the 'type' argument in the dyaddown function.

Even- or odd-indexed elements of X, specified as a positive integer.

Y contains the even- or odd-indexed samples of X depending on the value of EVENODD:

  • If EVENODD is even, then Y(k) = X(2k).

  • If EVENODD is odd, then Y(k) = X(2k+1).

Example: dyaddown(X,0) consists of even-indexed samples.

Type of downsampling , specified as one of the following:

  • 'c' to downsample columns of X

  • 'r' to downsample rows of X

  • 'm' to downsample rows and columns of X

Output Arguments

collapse all

Dyadic downsampled version of X, returned as a vector or a matrix.

References

[1] Strang, Gilbert, and Truong Nguyen. Wavelets and Filter Banks. Rev. ed. Wellesley, Mass: Wellesley-Cambridge Press, 1997.

Extended Capabilities

Version History

Introduced before R2006a

See Also