Function: firwin
FIRWIN  FIR window
  Usage:  g=firwin(name,M);
          g=firwin(name,M,...);
          g=firwin(name,x);
          
  FIRWIN(name,M) will return an FIR window of length M of type name.

  All windows are symmetric and generate zero delay and zero phase
  filters. They can be used for the Wilson and WMDCT transform, except
  when noted otherwise.

  FIRWIN(name,x) where x is a vector will sample the window
  definition as the specified points. The normal sampling interval for
  the windows is -.5< x <.5.

  In the following PSL means "Peak Sidelobe level", and the main lobe
  width is measured in normalized frequencies.

  If a window g forms a "partition of unity" (PU) it means specifically
  that:

    g+fftshift(g)==ones(L,1);

  A PU can only be formed if the window length is even, but some windows
  may work for odd lengths anyway.

  If a window is the square root of a window that forms a PU, the window
  will generate a tight Gabor frame / orthonormal Wilson/WMDCT basis if
  the number of channels is less than M.

  The windows available are:

    'hann'       von Hann window. Forms a PU. The Hann window has a
                 mainlobe with of 8/M, a PSL of -31.5 dB and decay rate
                 of 18 dB/Octave.

    'sine'       Sine window. This is the square root of the Hanning
                 window. The sine window has a mainlobe width of 8/M,
                 a  PSL of -22.3 dB and decay rate of 12 dB/Octave.
                 Aliases: 'cosine', 'sqrthann'

    'rect'       (Almost) rectangular window. The rectangular window has a
                 mainlobe width of 4/M, a PSL of -13.3 dB and decay
                 rate of 6 dB/Octave. Forms a PU if the order is odd.
                 Alias: 'square'

    'tria'       (Almost) triangular window. Forms a PU. Alias: 'bartlett'

    'sqrttria'   Square root of the triangular window.

    'hamming'    Hamming window. Forms a PU that sums to 1.08 instead
                 of 1.0 as usual. The Hamming window has a
                 mainlobe width of 8/M, a  PSL of -42.7 dB and decay
                 rate of 6 dB/Octave. This window should not be used for
                 a Wilson basis, as a reconstruction window cannot be
                 found by WILDUAL.

    'blackman'   Blackman window. The Blackman window has a
                 mainlobe width of 12/M, a PSL of -58.1 dB and decay
                 rate of 18 dB/Octave.

    'blackman2'  Alternate Blackman window. This window has a
                 mainlobe width of 12/M, a PSL of -68.24 dB and decay
                 rate of 6 dB/Octave.

    'itersine'   Iterated sine window. Generates an orthonormal
                 Wilson/WMDCT basis. This window is described in 
                 Wesfreid and Wickerhauser (1993) and is used in  the
                 ogg sound codec. Alias: 'ogg'

    'nuttall'    Nuttall window. The Nuttall window has a
                 mainlobe width of 16/M, a PSL of -93.32 dB and decay
                 rate of 18 dB/Octave.

    'nuttall10'  2-term Nuttall window with 1 continuous derivative. 
                 Alias: 'hann', 'hanning'.

    'nuttall01'  2-term Nuttall window with 0 continuous derivatives. 
                 This is a slightly improved Hamming window. It has a
                 mainlobe width of 8/M, a  PSL of -43.19 dB and decay
                 rate of 6 dB/Octave.

    'nuttall20'  3-term Nuttall window with 3 continuous derivatives. 
                 The window has a mainlobe width of 12/M, a PSL of 
                 -46.74 dB and decay rate of 30 dB/Octave.

    'nuttall11'  3-term Nuttall window with 1 continuous derivative. 
                 The window has a mainlobe width of 12/M, a PSL of 
                 -64.19 dB and decay rate of 18 dB/Octave.

    'nuttall02'  3-term Nuttall window with 0 continuous derivatives. 
                 The window has a mainlobe width of 12/M, a PSL of 
                 -71.48 dB and decay rate of 6 dB/Octave.

    'nuttall30'  4-term Nuttall window with 5 continuous derivatives. 
                 The window has a mainlobe width of 16/M, a PSL of 
                 -60.95 dB and decay rate of 42 dB/Octave.

    'nuttall21'  4-term Nuttall window with 3 continuous derivatives. 
                 The window has a mainlobe width of 16/M, a PSL of 
                 -82.60 dB and decay rate of 30 dB/Octave.

    'nuttall12'  4-term Nuttall window with 1 continuous derivatives. 
                 Alias: 'nuttall'.

    'nuttall03'  4-term Nuttall window with 0 continuous derivatives. 
                 The window has a mainlobe width of 16/M, a PSL of 
                 -98.17 dB and decay rate of 6 dB/Octave.

    'truncgauss' Gaussian window truncated at 1% of its height.
                 Alternatively, a custom percentage can be appended to
                 'truncgauss' e.g. 'truncgauss0.1' will create Gaussian
                 window truncated at 0.1% of its height.

  FIRWIN understands the following flags at the end of the list of input
  parameters:

    'shift',s    Shift the window by s samples. The value can be a
                 fractional number.

    'wp'         Output is whole point even. This is the default. It
                 corresponds to a shift of s=0.

    'hp'         Output is half point even, as most Matlab filter
                 routines. This corresponds to a shift of s=-.5
                  

    'taper',t    Extend the window by a flat section in the middle. The
                 argument t is the ratio of the rising and falling
                 parts as compared to the total length of the
                 window. The default value of 1 means no
                 tapering. Accepted values lie in the range from 0 to 1.

  Additionally, FIRWIN accepts flags to normalize the output. Please see
  the help of NORMALIZE. Default is to use 'peak' normalization,
  which is useful for using the output from FIRWIN for windowing in the
  time-domain. For filtering in the time-domain, a normalization of '1'
  or 'area' is preferable.

  Examples:
  ---------

  The following plot shows the magnitude response for some common
  windows:

    hold all; 
    L=30;
    dr=110;

    magresp(firwin('hanning',L,'1'),'fir','dynrange',dr);
    magresp(firwin('hamming',L,'1'),'fir','dynrange',dr);
    magresp(firwin('blackman',L,'1'),'fir','dynrange',dr);
    magresp(firwin('nuttall',L,'1'),'fir','dynrange',dr);
    magresp(firwin('itersine',L,'1'),'fir','dynrange',dr);

    legend('Hann','Hamming','Blackman','Nuttall','Itersine');


  References:
    A. V. Oppenheim and R. W. Schafer. Discrete-time signal processing.
    Prentice Hall, Englewood Cliffs, NJ, 1989.
    
    A. Nuttall. Some windows with very good sidelobe behavior. IEEE Trans.
    Acoust. Speech Signal Process., 29(1):84--91, 1981.
    
    F. Harris. On the use of windows for harmonic analysis with the
    discrete Fourier transform. Proceedings of the IEEE, 66(1):51 -- 83,
    jan 1978.
    
    E. Wesfreid and M. Wickerhauser. Adapted local trigonometric transforms
    and speech processing. IEEE Trans. Signal Process., 41(12):3596--3600,
    1993.
    

Url: http://ltfat.github.io/doc/sigproc/firwin.html

See also: freqwin, pgauss, pbspline, firkaiser, normalize.

Package: ltfat