**Articles in this series:**

How to Interpret FFT results – complex DFT, frequency bins and FFTShift

How to Interpret FFT results – obtaining Magnitude and Phase information

FFT and Spectral Leakage

How to plot FFT using Matlab – FFT of basic signals : Sine and Cosine waves

Generating Basic signals – Square Wave and Power Spectral Density using FFT

Generating Basic signals – Rectangular Pulse and Power Spectral Density using FFT

Generating Basic Signals – Gaussian Pulse and Power Spectral Density using FFT (this article)

Chirp Signal – Frequency Sweeping – FFT and power spectral density

Constructing the Auto Correlation Matrix using FFT

## Introduction

Numerous texts are available to explain the basics of Discrete Fourier Transform and its very efficient implementation – Fast Fourier Transform (FFT). Often we are confronted with the need to generate simple, standard signals (sine, cosine, Gaussian pulse, squarewave, isolated rectangular pulse, exponential decay, chirp signal) for simulation purpose. I intend to show (in a series of articles) how these basic signals can be generated in Matlab and how to represent them in frequency domain using FFT.

## Gaussian Pulse : Mathematical description:

In digital communications, Gaussian Filters are employed in Gaussian Minimum Shift Keying – GMSK (used in GSM technology) and Gaussian Frequency Shift Keying (GFSK). Two dimensional Gaussian Filters are used in Image processing to produce Gaussian blurs. The impulse response of a Gaussian Filter is Gaussian. Gaussian Filters give no overshoot with minimal rise and fall time when excited with a step function. Gaussian Filter has minimum group delay. The impulse response of a Gaussian Filter is written as a Gaussian Function as follows

$$ g(t) = \frac{1}{\sqrt{2 \pi } \sigma} e^{- \frac{t^2}{2 \sigma^2}} $$

The Fourier Transform of a Gaussian pulse preserves its shape.

$$ \begin{align*}

G(f) & =F[g(t)]\\

& = \int_{-\infty }^{\infty } g(t)e^{-j2\pi ft}\, dt\\

& = \frac{1}{\sigma \sqrt{2 \pi } } \int_{-\infty }^{\infty } e^{- \frac{t^2}{2 \sigma^2}}e^{-j2\pi ft}\, dt\\

&=\frac{1}{\sigma \sqrt{2 \pi } } \int_{-\infty }^{\infty } e^{- \frac{1}{2 \sigma^2}\left[t^2+j4 \pi \sigma^2 ft \right]}\, dt\\

&=\frac{1}{\sigma \sqrt{2 \pi } } \int_{-\infty }^{\infty } e^{- \frac{1}{2 \sigma^2}\left[t^2+j4 \pi \sigma^2 ft + (j 2 \pi \sigma^2 f)^2 – (j 2 \pi \sigma^2 f)^2\right]}\, dt\\

&=e^{ \frac{1}{2 \sigma^2}(j 2 \pi \sigma^2 f)^2}\frac{1}{\sigma \sqrt{2 \pi } } \int_{-\infty }^{\infty } e^{- \frac{1}{2 \sigma^2}\left[t+j 2 \pi \sigma^2 f \right]^2}\, dt\\

&=e^{ \frac{1}{2 \sigma^2}(j 2 \pi \sigma^2 f)^2}=e^{ – \frac{1}{2}( 2 \pi \sigma f)^2}

\end{align*} $$

The above derivation makes use of the following result from complex analysis theory and the property of Gaussian function – total area under Gaussian function integrates to 1. By change of variable, let \(u=t+j 2 \pi \sigma^2 f \). Then,

$$ \frac{1}{\sigma \sqrt{2 \pi } }\int_{-\infty }^{\infty }e^{- \frac{1}{2 \sigma^2}\left[t+j 2 \pi \sigma^2 f \right]^2}\, dt =\frac{1}{\sigma \sqrt{2 \pi } }\int_{-\infty }^{\infty }e^{- \frac{1}{2 \sigma^2} u^2}\, du =1 $$

Thus, the Fourier Transform of a Gaussian pulse is a Gaussian Pulse.

$$ \frac{1}{\sqrt{2 \pi } \sigma} e^{- \frac{t^2}{2 \sigma^2}} \rightleftharpoons e^{ – \frac{1}{2}( 2 \pi \sigma f)^2} $$

## Gaussian Pulse and its Fourier Transform using FFT:

The following code generates a Gaussian Pulse with \( \sigma=0.1s \). The Discrete Fourier Transform of this digitized version of Gaussian Pulse is plotted with the help of \(FFT\) function in Matlab.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
fs=80; %sampling frequency sigma=0.1; t=-0.5:1/fs:0.5; %time base variance=sigma^2; x=1/(sqrt(2*pi*variance))*(exp(-t.^2/(2*variance))); subplot(2,1,1) plot(t,x,'b'); title(['Gaussian Pulse \sigma=', num2str(sigma),'s']); xlabel('Time(s)'); ylabel('Amplitude'); L=length(x); NFFT = 1024; X = fftshift(fft(x,NFFT)); Pxx=X.*conj(X)/(NFFT*NFFT); %computing power with proper scaling f = fs*(-NFFT/2:NFFT/2-1)/NFFT; %Frequency Vector subplot(2,1,2) plot(f,abs(X)/(L),'r'); title('Magnitude of FFT'); xlabel('Frequency (Hz)') ylabel('Magnitude |X(f)|'); xlim([-10 10]) |

## Double Sided and Single Power Spectral Density using FFT:

Next, the Power Spectral Density (PSD) of the Gaussian pulse is constructed using the FFT. PSD describes the power contained at each frequency component of the given signal. Double Sided power spectral density is plotted first, followed by single sided power spectral density plot (retaining only the positive frequency side of the spectrum).

1 2 3 4 5 6 |
Pxx=X.*conj(X)/(L*L); %computing power with proper scaling figure; plot(f,10*log10(Pxx),'r'); title('Double Sided - Power Spectral Density'); xlabel('Frequency (Hz)') ylabel('Power Spectral Density- P_{xx} dB/Hz'); |

1 2 3 4 5 6 7 8 9 |
X = fft(x,NFFT); X = X(1:NFFT/2+1);%Throw the samples after NFFT/2 for single sided plot Pxx=X.*conj(X)/(L*L); f = fs*(0:NFFT/2)/NFFT; %Frequency Vector figure; plot(f,10*log10(Pxx),'r'); title('Single Sided - Power Spectral Density'); xlabel('Frequency (Hz)') ylabel('Power Spectral Density- P_{xx} dB/Hz'); |

**Rate this article:**

**Articles in this series:**

How to Interpret FFT results – complex DFT, frequency bins and FFTShift

How to Interpret FFT results – obtaining Magnitude and Phase information

FFT and Spectral Leakage

How to plot FFT using Matlab – FFT of basic signals : Sine and Cosine waves

Generating Basic signals – Square Wave and Power Spectral Density using FFT

Generating Basic signals – Rectangular Pulse and Power Spectral Density using FFT

Generating Basic Signals – Gaussian Pulse and Power Spectral Density using FFT (this article)

Chirp Signal – Frequency Sweeping – FFT and power spectral density

Constructing the Auto Correlation Matrix using FFT