## Syntax

``Y = dyadup(X)``
``Y = dyadup(X,EVENODD)``
``Y = dyadup(___,'type')``

## Description

````Y = dyadup(X)` upsamples odd-indexed elements of `X`. `Y` contains odd-index samples of `X` in this case. Specify `X` as a vector or matrix. When you specify `X` as a vector, the function returns an extended copy of vector `X` upsampled by inserting zeros. ```

example

````Y = dyadup(X,EVENODD)`, where `X` upsamples 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 an extended copy of vector `X` obtained by inserting zeros.`dyadup` implements a simple zero-padding scheme very useful in the wavelet reconstruction algorithm.```
````Y = dyadup(___,'type')` returns a extended copies of `X` obtained by inserting 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 upsample.

`s = 1:5 `
```s = 1×5 1 2 3 4 5 ```

Upsample elements at odd indices.

`dse = dyadup(s) `
```dse = 1×11 0 1 0 2 0 3 0 4 0 5 0 ```

You can also upsample the elements in X1 by setting `EVENODD` to `1`.

`dse1 = dyadup(s,1)`
```dse1 = 1×11 0 1 0 2 0 3 0 4 0 5 0 ```

Upsample elements at even indices.

`dso = dyadup(s,0) `
```dso = 1×9 1 0 2 0 3 0 4 0 5 ```

Create a matrix data that you want to upsample.

`s = (1:2)'*(1:3)`
```s = 2×3 1 2 3 2 4 6 ```

Upsample rows at even indices.

`der = dyadup(s,1,'r') `
```der = 5×3 0 0 0 1 2 3 0 0 0 2 4 6 0 0 0 ```

Upsample columns at odd indices.

`doc = dyadup(s,0,'c') `
```doc = 2×5 1 0 2 0 3 2 0 4 0 6 ```

Upsample rows and columns at even indices.

`dem = dyadup(s,1,'m')`
```dem = 5×7 0 0 0 0 0 0 0 0 1 0 2 0 3 0 0 0 0 0 0 0 0 0 2 0 4 0 6 0 0 0 0 0 0 0 0 ```

Using default values for `dyadup` and `dyaddown`, we have: `dyaddown(dyadup(s)) = s`.

`s = 1:5`
```s = 1×5 1 2 3 4 5 ```
`uds = dyaddown(dyadup(s))`
```uds = 1×5 1 2 3 4 5 ```

In general reversed identity is false.

## Input Arguments

collapse all

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

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

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

• If `EVENODD` is even, then ```Y(2k–1) = X(k), Y(2k) = 0```.

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

`dyadup` defaults to `EVENODD = 1` (zeros in odd-indexed positions).

Type of upsampling , specified as one of the following:

• `'c'` to upsample columns of `X`

• `'r'` to upsample rows of `X`

• `'m'` to upsample rows and columns of `X`

## Output Arguments

collapse all

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

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