# E12 Assignment 10

Description:

Problems:
1. Fourier Series, expression for cn

Consider the function fT(t) represented by the exponential Fourier series

Show that

Hint: try multiplying fT(t) by then integrating.

Solution:

Use hint.  Multiply

then integrate over one period

Switch order of integration and summation (and pull cn out of summation)

The function is periodic and has an integer number of complete oscillations in one period, T, unless m=n in which case the function is constant with a value of 1.  Therefore the integral is 0 unless m=n in which case the integral is T (integrating 1 over an interval of T).  As we perform the summation we multiply each cn by zero if m≠n, and by T if m=n.  Therefore the only term that makes it out of the summation is when m=n, so

or, by changing the variable and rearranging

2. Fourier Series, Sawtooth

For the function, fT, below:
a) Find the coefficients of a Fourier Sine Series (bn).
b) Find the coefficients of an Exponential Fourier Series (cn).
c) Show that the two answers are equivalent (i.e.,  bn=-2*imag(cn)).

Solution:

a) Exploit symmetries with Fourier Sine Series (function is odd, so we can use only sines).

since fT(t) and sin(nω0t) are odd, their product is even, so we can take twice the integral from 0 to T/2.  Also use the fact that fT(t)=2t in that interval, and T=2.

Use integration by parts or integration table (or MATLAB/Mathematica)

```>> syms t n
>> assume(n,'integer')
>> b=4*int(t*sin(n*pi*t),0,1)
b =
(4*(sin(pi*n) - pi*n*cos(pi*n)))/(pi^2*n^2)
>> pretty(simple(b))

n
4 (-1)
- -------
pi n```

b)  Exponential series

```>> syms t n
>> assume(n,'integer')
>> c=int(t*exp((0-1j)*n*pi*t),-1,1)
c =
(exp(-pi*n*i)*(pi*n*i + 1))/(pi^2*n^2) + (exp(pi*n*i)*(pi*n*i - 1))/(pi^2*n^2)
>> pretty(simple(c))

n
2 (-1)  i
---------
pi n```

c)   bn=-2*imag(cn), so they are equivalent.

3. Half Wave Rectified, Fourier Series

Show that the exponential series coefficients, cn, for the function shown below (a 60 Hz, half-wave rectified sine wave) are given by

Euler's identity for sin may be useful: . Also think about the value of e and e-jπ. Be prepared for lots of algebra in the solution.

Solution:

but ω0T=2π

Make use of the facts

So

Note: in the last line we had to go back to complex exponential form because we set jsin(-πn) to zero earlier (eq. 1), but now we are taking the limit as n→1, so the whole expression in (eq. 1) is going to zero.

4. Plot FS, Half Wave

Plot the half wave rectified function from the previous problem on the same plot as the sum of the first four non-zero terms of the Fourier Series.  Plot for t=0 to 1/30 second.   Note that as we add terms, the approximation converges to the function.

Below is some code you can use as a starting point.  If you run it as is it plots Fourier sum for square wave.

```% skeleton code  (use at your own peril) - as is, it plots Fourier Sum for square wave.
clear all

% Define constants
c_order='rgbcm';   %Order of colors used in plot.
N=8;                        %number of Fourier terms to plot
T=1/60;  wo=2*pi/T;         %Period and fundamental frequency
t=linspace(0,2*T,1000);     %Time vector

% % Plot a half-rectified sine wave (for E12 homework problem).
% y=sin(2*pi/T*t).*(sin(2*pi/T*t)>0);
% plot(t,y,'k:','LineWidth',2);

% Plot a square wave (as an example).
y = sin(2*pi/T*t)>0;
plot(t,y,'k:','LineWidth',2);
leg{1}='Function';      	%Create legend entry
axis([0 2*T -1.1 1.1]);
hold on

c0=0.5;                 %c0=DC component of Fourier Series
ysum=c0*ones(size(y));  %Set summation to average (or DC) value.

plot(t,ysum,'y');       %Plot ysum (the average value) in yellow
leg{2}='DC component';  %Create legend entry
axis([0 2*T -1.2 1.2]);

for n=1:N,                      %Form Fourier sum
cn=j/n/2/pi*(cos(n*pi)-1);  %Calculat cn.
an=2*real(cn);              %calculate an and bn from cn.
bn=-2*imag(cn);
ysum=ysum + an*cos(n*wo*t) + bn*sin(n*wo*t);  %Add to Fourier sum
plot(t,ysum,c_order(mod(n,5)+1));    %Plot - using color from c_order
leg{end+1} =['Sum of ' num2str(n)];  %Create legend entry
end

hold off
legend(leg,'location','se');
title('Function (black) and Fourier Approximations');
xlabel('t');```

Solution:
```% Plots Fourier Sum for half-wave rectified signal.
clear all

% Define constants
c_order='rgbcm'; %Order of colors used in plot.
N=7; %number of Fourier terms to plot
T=1/60; wo=2*pi/T; %Period and fundamental frequency
t=linspace(0,2*T,1000); %Time vector

% Plot a half-rectified sine wave
y=sin(2*pi/T*t).*(sin(2*pi/T*t)>0);
plot(t,y,'k:','LineWidth',2);
leg{1}='Original';
hold on

c0=1/pi; %c0=DC component of Fourier Series
ysum=c0*ones(size(y)); %Set summation to DC value.
plot(t,ysum,'y'); %Plot ysum in yellow
leg{2}='DC component'; %Create legend entry
axis([0 2*T -0.2 1.2]);

for n=[1 2 4 6 8], %Form Fourier sum
nc=n+0.001; %change n slightly to avoid 0/0
cn=-1/2/pi./(nc.^2-1).*(exp(-j*pi*nc)+1); %Calculat cn.
an=2*real(cn); %calculate an and bn from cn.
bn=-2*imag(cn);
ysum=ysum + an*cos(n*wo*t) + bn*sin(n*wo*t); %Add to Fourier sum
plot(t,ysum,c_order(mod(n,5)+1)); %Plot - using color from c_order
leg{end+1} =['Sum of ' num2str(n)]; %Create legend entry
end
hold off

legend(leg,'location','ne');
title('Function (black) and Fourier Approximations');
xlabel('t');```

5. FS of Time Delay

Prove that if

then

where the cn,x terms are the Fourier series coefficients of xT(t), and the cn,y terms are for yT(t)

Note the similarity to the time shift property of the Laplace Transform.

Solution:

The third line uses the fact that if we are integrating over a period, it doesn't matter if the function is shifted or not.

6. Time Shifted Rectangular Pulse, Fourier Series

In class we showed that the Fourier Series coefficients of the function shown (call it ΠT(t/Tp) - a rectangular pulse of period T, and width Tp, centered on the origin).

are given by

Use this result, and the time delay property derived previously, to find the coefficients, cn, of the function shown below without performing any integration. Once you have an expression for cn there is no need to simplify.

Solution:

Time delay is Tp/2, so Fourier Series coefficients for bottom function are

7. Fourier Series, Double Pulse (1)

Find the coefficients, cn, of the function shown below without performing any integration by representing the function as the differences of two pulse functions centered at t=0.

Solution:

The function is the sum of a pulse of amplitude 2 and width 6 minus a pulse of amplitude 3 and width 4.

Note that c0=0, and that the average value of the function is zero.

8. From Series to Transform

Briefly explain in your own words:

a) ...why the Fourier Series of xT(t) (periodic function with period=T) uses only sinusoids with discrete frequencies (0, ω0=2π/T)

b) ... why the Fourier Transform of x(t) has sinusoids with a continuum of frequencies (ω).

I'm looking for a fairly basic answer here, not a complicated discussion.

Solution:

a) Since xT(t) is periodic (with period=T), all of its composite functions must also be periodic with period T. A sinusoid at frequency 0, is periodic with period T (and has n oscillations in that time). The change in frequency as n increments by one is ω0=2π/T= Δω.

b) If we consider the function x(t) to be the function xT(t) as T→∞ (so it becomes aperiodic) the the change in frequency as n increments is ω0=2π/T=Δω→0 - in other words, the frequency becomes a continuum.