Created by Dr. V. R. Ratnaparkhe
Signals & SystemsVirtual Laboratory
Experiment 07 · Signals & Systems Lab

Fourier Transform & Spectra

Compute amplitude and phase spectra of a square pulse, sinusoid and exponential, and reconstruct with the inverse FT.

MagnitudePhaseInverse FTCO 1-3

Aim

Find the Fourier transform of a square pulse, a sinusoid and an exponential signal. Plot their amplitude and phase spectra, compare the results with the mathematical solutions, and find the inverse Fourier transform.

Objectives

  • Compute X(f) = ∫x(t)e^{−j2πft}dt numerically and analytically.
  • Read the magnitude spectrum |X(f)| and the phase spectrum ∠X(f).
  • See the time–bandwidth trade-off: a narrower pulse gives a wider spectrum.
  • Rebuild x(t) with the inverse FT using limited bandwidth, and watch the Gibbs ripples.

Fourier transform pair

X(f) = ∫ x(t) e^{−j2πft} dt x(t) = ∫ X(f) e^{+j2πft} df |X(f)| → amplitude spectrum ∠X(f) → phase spectrum

Standard results

x(t)X(f)Notes
A·rect(t/τ) (width τ, centred at 0)Aτ·sinc(fτ)Zeros at f = k/τ. Real, so the phase is 0 or ±π.
A·rect((t−t₀)/τ)Aτ·sinc(fτ)·e^{−j2πft₀}The delay adds a linear phase.
A·cos(2πf₀t)(A/2)[δ(f−f₀) + δ(f+f₀)]Over a finite window T: (AT/2)[sinc((f−f₀)T) + sinc((f+f₀)T)]
A·e^{−at}u(t), a > 0A / (a + j2πf)|X| = A/√(a²+(2πf)²), ∠X = −tan⁻¹(2πf/a)
A·e^{−a|t|}2aA / (a² + (2πf)²)Real and even, so the phase is 0.
Uncertainty principle: the duration and the bandwidth cannot both be small. Halving τ doubles the width of the main lobe of the sinc.

Numerical evaluation

In MATLAB, the integral is approximated by a Riemann or trapezoid sum on a fine grid: X = trapz(t, x.*exp(-1j*2*pi*f*t)), or with the FFT scaled by Δt: X = dt*fftshift(fft(x)).

  1. Choose Square pulse with τ = 1 s. Check that the first zero of |X(f)| is at 1/τ = 1 Hz, and that X(0) = Aτ.
  2. Halve τ. Note how the main lobe gets wider. Add a delay t₀ and watch the phase become a straight sloped line while the magnitude stays the same.
  3. Choose Sinusoid. Increase the window T and watch the peaks become narrower and taller, getting closer to impulses.
  4. Choose Exponential. Compare the numeric curve with A/(a+j2πf) and read the phase at f = a/2π (it should be −45°).
  5. In the Inverse FT panel, lower the bandwidth B and see the ripples (Gibbs phenomenon) at the pulse edges.
  6. Record |X(f)| at a test frequency for every signal and compare it with your hand calculation.

Pre-lab diagnostic

Signal

AudioLive timbre builds a 110 Hz tone whose harmonics are X(k/T₀)/T₀. Drag τ: a narrow pulse has a wide spectrum and sounds bright; a wide pulse sounds mellow.
x(t)
|X(f)| — numeric (solid) vs analytical (dashed)
∠X(f) in radians — numeric (solid) vs analytical (dashed)

Inverse Fourier transform

Reconstruction

x̂(t) = ∫−BB X(f)e^{j2πft}df

x(t) original (blue) vs inverse FT x̂(t) (green)

Spectrum comparison

Analysis

Post-lab quiz

Self-evaluation

exp7_fourier.m

%% Experiment 7: Fourier transform of standard signals
clc; clear; close all;
dt = 1e-3;  t = -5:dt:5;  f = -5:0.01:5;
A = 1; tau = 1; a = 2; f0 = 2;
x1 = A*(abs(t) <= tau/2);                 % square pulse
x2 = A*cos(2*pi*f0*t).*(abs(t)<=2);       % windowed sinusoid, T = 4
x3 = A*exp(-a*t).*(t>=0);                  % exponential
FT = @(x) arrayfun(@(ff) trapz(t, x.*exp(-1j*2*pi*ff*t)), f);
X1 = FT(x1); X2 = FT(x2); X3 = FT(x3);
X1th = A*tau*sinc(f*tau);                    % MATLAB sinc = sin(pi x)/(pi x)
X3th = A./(a + 1j*2*pi*f);
subplot(3,2,1); plot(f,abs(X1),f,abs(X1th),'--'); title('|X_1(f)|');
subplot(3,2,2); plot(f,angle(X1));               title('\angle X_1(f)');
subplot(3,2,3); plot(f,abs(X2));                title('|X_2(f)|');
subplot(3,2,4); plot(f,angle(X2));               title('\angle X_2(f)');
subplot(3,2,5); plot(f,abs(X3),f,abs(X3th),'--'); title('|X_3(f)|');
subplot(3,2,6); plot(f,angle(X3),f,angle(X3th),'--'); title('\angle X_3(f)');
%% Inverse FT (band-limited to |f| <= B)
B = 5; fi = -B:0.01:B; X1i = A*tau*sinc(fi*tau);
xr = arrayfun(@(tt) real(trapz(fi, X1i.*exp(1j*2*pi*fi*tt))), t);
figure; plot(t,x1,t,xr); legend('x(t)','IFT');
% symbolic: syms t f; fourier(exp(-2*t)*heaviside(t))