Documentation

wextend

Extend vector or matrix

Syntax

YEXT= wextend(TYPE,MODE,X,LEN)
YEXT= wextend(TYPE,MODE,X,LEN,LOC)

Description

YEXT= wextend(TYPE,MODE,X,LEN) returns an extended version of the input matrix or vector, X. The TYPE specifies the general method to extend the input. The MODE is the specific extension to use. The LEN is the amount by which to extend the input. The tables show the valid values for TYPE and MODE.

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.

For more information on symmetric extension modes see References.

YEXT= wextend(TYPE,MODE,X,LEN,LOC) uses the specified location, LOC, for the extension. Valid and default values of LOC and description of LEN for each TYPE are described in the table.

TYPELOC
1, '1', 1d' or '1D''l' (or 'u') for left (or up) extension.
'r' (or 'd') for right (or down) extension.
'b' for extension on both sides.
'n' null extension.
Default: 'b'

LEN is the length of the extension.
2, '2', '2d' or '2D' [LOCROW,LOCCOL], where LOCROW and LOCCOL are 1D extension locations or 'n' (none).
Default: 'bb'

LEN, expressed as [LROW,LCOL], is the number of rows LROW and number of columns LCOL to add.
'ar', or 'addrow''l' (or 'u') for left (or up) extension.
'r' (or 'd') for right (or down) extension.
'b' for extension on both sides.
'n' null extension.
Default: 'b'

LEN is the number of rows to add.
'ac', or 'addcol''l' (or 'u') for left (or up) extension.
'r' (or 'd') for right (or down) extension.
'b' for extension on both sides.
'n' null extension.
Default: 'b'

LEN is the number of columns to add.

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.

Introduced before R2006a

Was this topic helpful?