Main Content

sigwin.flattopwin Class

Namespace: sigwin

Construct flat top window object

Description

Note

The use of sigwin.flattopwin is not recommended. Use flattopwin instead.

sigwin.flattopwin creates a handle to a flat top window object for use in spectral analysis and FIR filtering by the window method. Object methods enable workspace import and ASCII file export of the window values.

Construction

H = sigwin.flattopwin returns a flat top window object H of length 64 with symmetric sampling.

H = sigwin.flattopwin(Length) returns a flat top window object of length Length with symmetric sampling. Length must be a positive integer. Entering a positive noninteger value for Length rounds the length to the nearest integer. Entering a 1 for Length results in a window with a single value of 1.

H = sigwin.flattopwin(Length,SamplingFlag) returns a flat top window object H of length Length with sampling SamplingFlag. The SamplingFlag can be either 'symmetric' or 'periodic'.

Properties

Length

Flat top window length. Must be a positive integer. Entering a positive noninteger value for Length rounds the length to the nearest integer. Entering a 1 for Length results in a window with a single value of 1.

SamplingFlag

'symmetric' is the default and forces exact symmetry between the first and second halves of the flat top window. A symmetric window is preferred in FIR filter design.

'periodic' designs a symmetric flat top window of length Length+1 and truncates the window to length Length. This design is preferred in spectral analysis where the window is treated as one period of a Length-point periodic sequence.

Methods

generateGenerates flat top window
infoDisplay information about flat top window object
winwriteSave flat top window in ASCII file

Copy Semantics

Handle. To learn how copy semantics affect your use of the class, see Copying Objects in the MATLAB® Programming Fundamentals documentation.

Examples

collapse all

Generate a flat top window of length N = 16. Return its values as a column vector. Show information about the window object. Display the window.

H = sigwin.flattopwin(16);

win = generate(H)
win = 16×1

   -0.0004
   -0.0061
   -0.0314
   -0.0677
   -0.0316
    0.1982
    0.6069
    0.9487
    0.9487
    0.6069
      ⋮

wininfo = info(H)
wininfo = 4x26 char array
    'Flat Top Window           '
    '---------------           '
    'Length         : 16       '
    'Sampling Flag  : symmetric'

wvtool(H)

Algorithms

The following equation defines the flat top window of length N:

w(n)=a0a1cos2πnN1+a2cos4πnN1a3cos6πnN1+a4cos8πnN1,0nM1,

where M is N/2 for N even and (N + 1)/2 for N odd.

The second half of the symmetric flat top window MnN1 is obtained by flipping the first half around the midpoint. The symmetric option is the preferred method when using a flat top window in FIR filter design by the window method.

The periodic flat top window is constructed by extending the desired window length by one sample, constructing a symmetric window, and removing the last sample. The periodic version is the preferred method when using a flat top window in spectral analysis because the discrete Fourier transform assumes periodic extension of the input vector.

The coefficients are listed in the following table:

CoefficientValue
a00.21557895
a10.41663158
a20.277263158
a30.083578947
a40.006947368

References

Oppenheim, Alan V., and Ronald W. Schafer. Discrete-Time Signal Processing. Upper Saddle River, NJ: Prentice Hall, 1989.