Documentation |
sigwin.hann creates a handle to a Hann 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.
The symmetric Hann window of length N is defined as:
$$w(n)=0.5(1-\mathrm{cos}(2\pi n/N-1))\text{\hspace{1em}}0\le n\le M-1$$
where M is N/2 for N even and (N+1)/2 for N odd.
The second half of the symmetric Hann window $$M\le n\le N-1$$ is obtained by flipping the first half around the midpoint. The symmetric option is the preferred method when using a Hann window in FIR filter design.
The periodic Hann 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 Hann window in spectral analysis because the discrete Fourier transform assumes periodic extension of the input vector.
H = sigwin.hann returns a symmetric Hann window object H of length 64.
H = sigwin.hann(Length) returns a symmetric Hann window object with length Length. Length requires 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.hann(Length,SamplingFlag) returns a Hann window object with sampling Sampling_Flag. The SamplingFlag can be either 'symmetric' or 'periodic'.
Length |
Hann 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 Hann window. A symmetric window is preferred in FIR filter design by the window method. 'periodic' designs a symmetric Hann 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. |
generate | Generates Hann window |
info | Display information about Hann window object |
winwrite | Save Hann window object values in ASCII file |
Handle. To learn how copy semantics affect your use of the class, see Copying Objects in the MATLAB^{®} Programming Fundamentals documentation.
Default length N=64 symmetric Hann window:
H=sigwin.hann; wvtool(H);
Generate length N=128 periodic Hann window, return values, and write ASCII file:
H=sigwin.hann(128,'periodic'); % Return window with generate win=generate(H); % Write ASCII file in current directory % with window values winwrite(H,'hann_128')