Accelerating the pace of engineering and science

# Documentation Center

• Trial Software
• Product Updates

# gausswin

Gaussian window

## Syntax

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

## Description

w = gausswin(N) returns an N-point Gaussian window in the column vector w. N is a positive integer. The coefficients of a Gaussian window are computed from the following equation.

where , 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

The value of α defaults to 2.5.

w=gausswin(N,Alpha) returns an N-point Gaussian window where Alpha is proportional to reciprocal of the standard deviation. The width of the window is inversely related to the value of α; a larger value of α produces a more narrow window.

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

## Examples

Create a 64-point Gaussian window and display the result in WVTool:

```L=64;
wvtool(gausswin(L))
```

### Gaussian Window and the Fourier Transform

This example demonstrates 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 α=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;
y = exp(-1/2*(alpha*n/(N/2)).^2);
w = gausswin(N,alpha);
plot(n,w,'r')
hold on;
plot(n,y,'k')
title('Gaussian Window N = 64');```

Obtain the Fourier transform of the Gaussian window and use fftshift to center the Fourier transform at zero frequency (DC).

```figure
wdft = fftshift(fft(w));
freq = linspace(-pi,pi,length(wdft));
plot(freq,abs(wdft),'linewidth',2)
xlabel('Radians/Sample');
title('Fourier Transform of Gaussian Window');```

The Fourier transform of the Gaussian window is also Gaussian with a standard deviation that is the reciprocal of the time-domain standard deviation.

## References

[1] Harris, F.J. "On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform." Proceedings of the IEEE®. Vol. 66, No. 1 (January 1978).

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

## See Also

Was this topic helpful?