wextend

Extend vector or matrix

Syntax

Description

The valid extension types (TYPE) are listed in the table below.

TYPEDescription
1'1''1d' or '1D'

1-D extension

2'2''2d' or '2D'

2-D extension

'ar' or 'addrow'

Add rows

'ac' or 'addcol'

Add columns

The valid extension modes (MODE) are listed in the table below.

MODE

Description

'zpd'

Zero extension

'sp0'

Smooth extension of order 0

'spd' (or 'sp1')

Smooth extension of order 1

'sym' or 'symh'

Symmetric-padding (half-point): boundary value symmetric replication

'symw'

Symmetric-padding (whole-point): boundary value symmetric replication

'asym' or 'asymh'

Antisymmetric-padding (half-point): boundary value antisymmetric replication

'asymw'

Antisymmetric-padding (whole-point): boundary value antisymmetric replication

'ppd'

Periodized extension (1)

'per'

Periodized extension (2):

If the signal length is odd, wextend adds an extra sample, equal to the last value, on the right and performs extension using the 'ppd' mode. Otherwise, 'per' reduces to 'ppd'. The same kind of rule stands for images.

With TYPE = {1, '1', '1d' or '1D'}:

  • LOC = 'l' (or 'u') for left (or up) extension.

  • LOC = 'r' (or 'd') for right (or down) extension.

  • LOC = 'b' for extension on both sides.

  • LOC = 'n' null extension.

  • The default is LOC = 'b'.

  • L is the length of the extension.

With TYPE = {'ar', 'addrow'}:

  • LOC is a 1D extension location.

  • The default is LOC = 'b'.

  • L is the number of rows to add.

With TYPE = {'ac', 'addcol'}:

  • LOC is a 1D extension location.

  • The default is LOC = 'b'.

  • L is the number of columns to add.

With TYPE = {2, '2', '2d' or '2D'}:

  • LOC = [LOCROW,LOCCOL] where LOCROW and LOCCOL are 1D extension locations or 'n' (none).

  • The default is LOC = 'bb'.

  • L = [LROW,LCOL] where LROW is the number of rows to add and LCOL is the number of columns to add.

For more information on symmetric extension modes see "References".

Examples

% Original signal.
x = [1 2 3]

x =

     1     2     3

% 1-D extension length.
l = 2;

% Zero-padding extensions 1-D.
xextzpd1 = wextend('1','zpd',x,l)
xextzpd1 =

     0     0     1     2     3     0     0

xextzpd2 = wextend('1D','zpd',x,l,'b')

xextzpd2 =

     0     0     1     2     3     0     0

% Symmetric extension 1-D.
xextsym = wextend('1D','sym',x,l)

xextsym =

     2     1     1     2     3     3     2

% Periodic extension 1-D.
xextper = wextend('1D','per',x,l)

xextper =

     3     3     1     2     3     3     1     2

% Original image.
X = [1 2 3;4 5 6]

X =
     1     2     3
     4     5     6

% 2-D extension length.
l = 2;

% Zero-padding extension 2-D.
Xextzpd = wextend(2,'zpd',X,l)

Xextzpd =
     0     0     0     0     0     0     0
     0     0     0     0     0     0     0
     0     0     1     2     3     0     0
     0     0     4     5     6     0     0
     0     0     0     0     0     0     0
     0     0     0     0     0     0     0

% Symmetric extension 2-D.
Xextsym = wextend('2D','sym',X,l)

Xextsym =
     5     4     4     5     6     6     5
     2     1     1     2     3     3     2
     2     1     1     2     3     3     2
     5     4     4     5     6     6     5
     5     4     4     5     6     6     5
     2     1     1     2     3     3     2

References

Strang, G.; T. Nguyen (1996), Wavelets and filter banks, Wellesley- Cambridge Press.

Was this topic helpful?