Engee documentation

enbw

Equivalent noise band.

Library

EngeeDSP

Syntax

Function call

  • bw = enbw(window) — returns a two-way equivalent noise band bw for the window window with uniform sampling. The equivalent noise band is normalized in terms of noise power per frequency resolution element.

  • bw = enbw(window,fs) — returns a two-way equivalent noise band bw in Hz.

Arguments

Input arguments

# window — window vector

+ A real vector is a string | real column vector

Details

A uniformly discretized window vector defined as a row vector or column vector with real elements.

Типы данных

Float64, Float32

# fs — sampling rate
positive scalar

Details

The sampling rate, set as a positive scalar.

Output arguments

# bw is the equivalent noise band

+ positive scalar

Details

The equivalent noise band returned as a positive scalar.

Типы данных

Float64, Float32

Examples

The equivalent noise band of the Hamming window

Details

Let’s define an equivalent Hamming window noise band of length 1000 counts.

import EngeeDSP.Functions: enbw, hamming

bw = enbw(hamming(1000))
1.3638074449828943

Equivalent noise band of a flat-topped window

Details

Let’s define the equivalent noise band (in Hz) of a window with a flat top of length 10000 counts. The sampling rate is 44.1 kHz.

import EngeeDSP.Functions: enbw, flattopwin

bw = enbw(flattopwin(10000), 44.1e3)
16.62845617599036

Equivalent bandwidth of rectangular noise

Details

Let’s define the equivalent bandwidth of the rectangular noise of the Hanna window with 128 by counting down.

Let’s generate a window and calculate its discrete Fourier transform by 2048 frequencies. Shift the transform so that it is centered at zero frequency, and calculate the square of its modulus.

import EngeeDSP.Functions: hann, fftshift, fft

lw = 128
win = hann(lw)
lt = 2048
windft = fftshift(fft(win, lt))

ad = abs.(windft).^2
mg = maximum(ad)

Specify the sampling frequency 1 kHz. Using the function enbw to calculate the equivalent noise band of the window and make sure that the value matches the definition.

import EngeeDSP.Functions: enbw

fs = 1000

bw = enbw(win, fs)
11.811023622047246
bdef = sum(win.^2) / sum(win)^2 * fs
11.811023622047246

Let’s plot the square of the window module. We will impose a rectangle with a height equal to the peak of the square of the amplitude and a width equal to the equivalent noise band.

freq = range(-fs/2, fs/2 - fs/lt, length=lt)

plot(freq, ad, xlims=(-bw, bw), grid=false)
plot!(bw/2 * [-1, -1, 1, 1], mg * [0, 1, 1, 0], linestyle=:dash)

enbw 1

Let’s make sure that the area of the rectangle has the same total capacity as the window.

using Pkg
Pkg.add("NumericalIntegration")
using NumericalIntegration

Adiff = integrate(freq, ad) - bw * mg
-1.4551915228366852e-11

Let’s repeat the calculation using normalized frequencies. Let’s find the equivalent noise band of the window. Let’s make sure that enbw gives the same meaning as the definition.

bw = enbw(win)
1.5118110236220474
bdef = sum(win.^2) / sum(win)^2 * lw
1.5118110236220474

Let’s plot the square of the window module. We will impose a rectangle with a height equal to the peak of the square of the amplitude and a width equal to the equivalent noise band.

freqn = range(-1/2, 1/2 - 1/lt, length=lt)

plot(freqn, ad, xlims=(-bw/lw, bw/lw), grid=false)
plot!((bw/2 * [-1, -1, 1, 1]) / lw, mg * [0, 1, 1, 0], linestyle=:dash)

enbw 2

Let’s make sure that the area of the rectangle has the same total capacity as the window.

Adiff = integrate(freqn, ad) - bw * mg / lw
-1.4210854715202004e-14

Additional Info

Equivalent noise band

Details

The total power contained in the window is the area under the curve formed by the square of the window’s Fourier transform module. The equivalent noise band_ of the window is the width of the rectangle, the height of which is equal to the peak of the square of the Fourier transform module, and the area is full power.

Parseval’s theorem states that the total energy of a window from counts it is equal to the sum of the squares of the modules of the window samples in the time domain or the frequency integral of the square of the module of the Fourier transform of the window:

The power spectrum of the window has a peak amplitude at :

To find the width of the equivalent rectangle and therefore the equivalent noise band, divide the area by the height:

If the sampling rate is set , function enbw returns the previous expression multiplied by :

For normalized frequencies, the function is divided by the bin width, :

See the example Equivalent bandwidth of rectangular noise, which is for a given window

  • compares the result enbw with a definition for a given sampling rate and normalized frequencies;

  • plots the equivalent rectangular bandwidth across the window amplitude spectrum;

  • checks that the total power contained in the window is the same as the power contained in the rectangle, the height of which is equal to the square of the peak amplitude of the Fourier transform of the window, and the width is equal to the equivalent noise band.

Literature

  1. Harris, Fredric J. «On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform.» Proceedings of the IEEE®. Vol. 66, January 1978, pp. 51–83.