Question

# a) Let ?(?) = { 1 for 0 ≤ ? ≤ 1 and −1, for 2...

a) Let ?(?) = { 1 for 0 ≤ ? ≤ 1 and −1, for 2 ≤ ? ≤ 3 be a periodic signal with fundamental period 3. Calculate the Fourier Series coefficients of ?(?), ??, by hand. Simplify your result as much as you can.

b) By using a 3x1 subplot, plot ?(?) signal in the first row. Take ? between 0 s and 10 s with an increment of 1 ms. Furthermore, calculate and plot the Fourier series representation of ?(?) = ∑ ??? ? ???0? ?=−? for ? = 10 and ? = 100 in the second and third rows of the subplot. Note that, ?(?) = ∑ ??? ? ???0? ?=−? should be calculated by MATLAB. Please comment on increasing ? on your results. Do not forget axis labels.

clc
clear all

t = linspace(0,10,10000);
x = [ones(1,1000) zeros(1,1000) -1*ones(1,1000) ones(1,1000) zeros(1,1000) -1*ones(1,1000) ones(1,1000) zeros(1,1000) -1*ones(1,1000) ones(1,1000)];

N1 = 10;
N2 = 100;
x1 = zeros((2*N1+1),size(t,2));
x2 = zeros((2*N2+1),size(t,2));
p = 0-N1;
q = 0-N2;
for i = 1:(2*N1+1)
x1(i,:) = x1(i,:) + (1/(j*p*pi))*(1 - cos(2*p*pi/3))*exp((j*p*2*pi*t)/3);
p = p+1;
end
x1((N1+1),:) = zeros(size(t));
for i = 1:(2*N2+1)
x2(i,:) = x2(i,:) + (1/(j*q*pi))*(1 - cos(2*q*pi/3))*exp((j*q*2*pi*t)/3);
q = q+1;
end
x1((N1+1),:) = zeros(size(t));
x2((N2+1),:) = zeros(size(t));
subplot(3,1,1)
plot(t, x, 'r-', 'MarkerFaceColor', 'r', ...
'MarkerSize', 12);
xlabel('time')
ylabel('magnitude')
title('x(t) original')
subplot(3,1,2)
plot(t, sum(x1), 'r-', 'MarkerFaceColor', 'r', ...
'MarkerSize', 12);
xlabel('time')
ylabel('magnitude')
title('x(t) with N = 10')
subplot(3,1,3)
plot(t, sum(x2), 'r-', 'MarkerFaceColor', 'r', ...
'MarkerSize', 12);
xlabel('time')
ylabel('magnitude')
title('x(t) with N = 100')

With increasing N the fourier series approximation tends towards original x(t).

#### Earn Coins

Coins can be redeemed for fabulous gifts.