Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

gausswin

Gaussian window

Syntax

w = gausswin(N)
w = gausswin(N,Alpha)

Description

w = gausswin(N) returns an N-point Gaussian window in a column vector, w. N is a positive integer.

w = gausswin(N,Alpha) returns an N-point Gaussian window with Alpha proportional to the reciprocal of the standard deviation. The width of the window is inversely related to the value of α. A larger value of α produces a narrower window. The value of α defaults to 2.5.

    Note   If the window appears to be clipped, increase N, the number of points.

Examples

collapse all

Create a 64-point Gaussian window. Display the result in wvtool.

L = 64;
wvtool(gausswin(L))

This example shows that the Fourier transform of the Gaussian window is also Gaussian with a reciprocal standard deviation. This is an illustration of the time-frequency uncertainty principle.

Create a Gaussian window of length 64 by using gausswin and the defining equation. Set $\alpha = 8$, which results in a standard deviation of 64/16 = 4. Accordingly, you expect that the Gaussian is essentially limited to the mean plus or minus 3 standard deviations, or an approximate support of [-12, 12].

N = 64;
n = -(N-1)/2:(N-1)/2;
alpha = 8;

w = gausswin(N,alpha);

stdev = (N-1)/(2*alpha);
y = exp(-1/2*(n/stdev).^2);

plot(n,w)
hold on
plot(n,y,'.')
hold off

xlabel('Samples')
title('Gaussian Window, N = 64')

Obtain the Fourier transform of the Gaussian window at 256 points. Use fftshift to center the Fourier transform at zero frequency (DC).

nfft = 4*N;
freq = -pi:2*pi/nfft:pi-pi/nfft;

wdft = fftshift(fft(w,nfft));

The Fourier transform of the Gaussian window is also Gaussian with a standard deviation that is the reciprocal of the time-domain standard deviation. Include the Gaussian normalization factor in your computation.

ydft = exp(-1/2*(freq/(1/stdev)).^2)*(stdev*sqrt(2*pi));

plot(freq/pi,abs(wdft))
hold on
plot(freq/pi,abs(ydft),'.')
hold off

xlabel('Normalized frequency (\times\pi rad/sample)')
title('Fourier Transform of Gaussian Window')

More About

collapse all

Algorithms

The coefficients of a Gaussian window are computed from the following equation:

w(n)=e12(αn(N1)/2)2=en2/2σ2,

where –(N – 1)/2 ≤ n ≤ (N – 1)/2 and α is inversely proportional to the standard deviation, σ, of a Gaussian random variable. The exact correspondence with the standard deviation of a Gaussian probability density function is σ = (N – 1)/(2α).

References

[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.

[2] Roberts, Richard A., and C. T. Mullis. Digital Signal Processing. Reading, MA: Addison-Wesley, 1987, pp. 135–136.

See Also

Apps

Functions

Introduced before R2006a

Was this topic helpful?