Main Content

Generate and Apply Hamming Window

The following model uses the Window Function block to generate and apply a Hamming window to a 3-dimensional input array.

In this example, set the Operation parameter of the Window Function block to Generate and apply window. The block provides two outputs: the window vector, Window at the Win port, and the result of the multiplication, simout at the Out port.

Open the model ex_windowfunction_ref.

Run the model.

The length of the first dimension of the input array is 10, so the Window Function block generates and outputs a Hamming window vector of length 10. To see the window vector generated by the Window Function block, type Window at the MATLAB® command line.

Window = 

    0.0800
    0.1876
    0.4601
    0.7700
    0.9723
    0.9723
    0.7700
    0.4601
    0.1876
    0.0800

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 15

To see the result of the multiplication, type simout at the MATLAB command line.

simout = 

(:,:,1) =
    0.0791    0.0791
    0.1875    0.1875
    0.4600    0.4600
    0.7695    0.7695
    0.9717    0.9717
    0.9717    0.9717
    0.7695    0.7695
    0.4600    0.4600
    0.1875    0.1875
    0.0791    0.0791
(:,:,2) =
    0.0791    0.0791
    0.1875    0.1875
    0.4600    0.4600
    0.7695    0.7695
    0.9717    0.9717
    0.9717    0.9717
    0.7695    0.7695
    0.4600    0.4600
    0.1875    0.1875
    0.0791    0.0791
(:,:,3) =
    0.0791    0.0791
    0.1875    0.1875
    0.4600    0.4600
    0.7695    0.7695
    0.9717    0.9717
    0.9717    0.9717
    0.7695    0.7695
    0.4600    0.4600
    0.1875    0.1875
    0.0791    0.0791
(:,:,4) =
    0.0791    0.0791
    0.1875    0.1875
    0.4600    0.4600
    0.7695    0.7695
    0.9717    0.9717
    0.9717    0.9717
    0.7695    0.7695
    0.4600    0.4600
    0.1875    0.1875
    0.0791    0.0791
(:,:,5) =
    0.0791    0.0791
    0.1875    0.1875
    0.4600    0.4600
    0.7695    0.7695
    0.9717    0.9717
    0.9717    0.9717
    0.7695    0.7695
    0.4600    0.4600
    0.1875    0.1875
    0.0791    0.0791

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 10

See Also

Blocks