Approximating Periodic Signals via Fourier Series [aka Harmonic Analysis]
Fact 1: Any periodic function of time, with period T can be approximated as a Fourier series
, where the kth Fourier series coefficient is and .
Example 1 Let , with period . Then where . Recall Euler’s identity: . This allows to be expressed as
. Since , it follows that
. Note that for any integer : . Hence,
and . Consequently,
the Fourier series for includes only two terms, as shown at right.
Before proceeding to a second example, we present
Fact 2. Let any with period T have and . Let . Then .
Proof: We offer a proof of this fact, not because this is a math class, but because it may demystify operations involving complex numbers and provide some ‘tricks of the trade’ when arriving at properties involving Fourier transforms.
. Let . Then , and the limits of integration for are . Hence, . However, since both and are periodic over the interval , then so is their product. The integral of this product is the same, no matter the value of . Hence, we can integrate it over the interval . This gives: . □
Example 2 Let , with period . Write . Now , and . Hence, , where . Hence, from Fact 2 we have
, and . □
From Examples 1 and 2 we see that the Fourier series coefficients (FSCs) for cosines are purely real, while those for sines are purely imaginary. However, both have the same magnitudes. Hence, for , the FSCs will generally be complex-valued. Often, however, we are not as interested in the FSCs themselves, as we are in their magnitudes. In fact, we are usually interested in the square of their magnitudes, which, in electrical engineering parlance, is called their powers.
Definition 1 The power associated with the FSC is defined as . Since any real-valued has , it follows that . In words, the power spectrum is symmetric about . For this reason it is called the two-sided power spectrum. Since engineers usually do not care to consider negative frequencies, they, instead, deal with the one-sided power spectrum, which is .
Example 3 The one-sided power spectrum for with frequency is . This power can be computed directly as . □
Example 4 Compute, then plot the one-sided power spectrum for the periodic square wave shown at right. where for .
Solution:
For : . Also, for , .
It follows that .
Hence, the one-sided power spectrum is
. □ Figure E4 One-sided power spectrum.
Verify the above using the command ‘fft’ for T=1. []
%PROGRAM NAME: squarewave_pwr.m
T=1; n=100; dt=T/n;
t=0:dt:T-dt; t=t';
u1=ones(n/2,1); u2=-u1; u=[u1;u2];
U=fft(u);
P=2*abs(U(1:n/2)).^2;
P=P*dt^2; %Account for the dt factor in the integral.
ws=2*pi/dt; dw=2*pi/T;
w=0:dw:ws/2 - dw; w=w';
figure(20)
stem(w,P)
title('Square Wave Power Spectrum')
xlabel('Frequency (rad/sec)')
grid