This is where navigation should be.

MIDDLEPAD - Symmetrically zero-extends or cuts a function

Usage

h=middlepad(f,L);
h=middlepad(f,L,dim);
h=middlepad(f,L,...);

Description

middlepad(f,L) cuts or zero-extends f to length L by inserting zeros in the middle of the vector, or by cutting in the middle of the vector.

If f is whole-point even, middlepad(f,L) will also be whole-point even.

middlepad(f,L,dim) does the same along dimension dim.

If f has even length, then f will not be purely zero-extended, but the last element will be repeated once and multiplied by 1/2. That is, the support of f will increase by one!

Adding the flag 'wp' as the last argument will cut or extend whole point even functions. Adding 'hp' will do the same for half point even functions.