Example – FS of CT Periodic Signal
clc clear all close all
t = ‐3:0.01:3; % duration of signal
% dc component for k=0 x0 = 1;
% first harmonic components for k=‐1 and k=1
x1 = (1/4)*exp(j*(‐1)*2*pi*t)+(1/4)*exp(j*(1)*2*pi*t);
y1 = x0 + x1; % sum of dc component and first harmonic
% second harmonic components for k=‐2 and k=2
x2 = (1/2)*exp(j*(‐2)*2*pi*t)+(1/2)*exp(j*(2)*2*pi*t);
y2 = y1 + x2; % sum of all components until second harmonic
% third harmonic components for k=‐3 and k=3
x3 = (1/3)*exp(j*(‐3)*2*pi*t)+(1/3)*exp(j*(3)*2*pi*t);
x = x0 + x1 + x2 + x3; % sum of all components until third harmonic
figure; subplot(3,2,1);
plot(t,x1);
axis([‐3 3 ‐2 2]);
title('x1(t)');
subplot(3,2,2);
plot(t,y1); axis([‐3 3 ‐0.2 2]);
title('x0(t)+x1(t)');
subplot(3,2,3);
plot(t,x2);
axis([‐3 3 ‐2 2]);
title('x2(t)');
subplot(3,2,4);
plot(t,y2);
axis([‐3 3 ‐1 3]);
title('x0(t)+x1(t)+x2(t)');
subplot(3,2,5);
plot(t,x3);
xlabel('t');
axis([‐3 3 ‐1 1]);
title('x3(t)');
subplot(3,2,6);
plot(t,x);
xlabel('t');
axis([‐3 3 ‐1 4]);
title('x(t)=x0(t)+x1(t)+x2(t)+x3(t)')
Synthesis of a Simple Periodic Signal
Once the Fourier series (FS) coefficient of a continuous time periodic signal is determined analytically using analysis equation, signal can be reconstructed using synthesis equation. Consider the periodic square wave signal defined as
where T is the time period and T1 is the duty cycle with FS coefficients
In the following examples, first and ideal square wave is created and then square wave is approximated from its harmonics using synthesis equation by letting k in the partial sum go from –M to M instead of ‐ ∞ to + ∞ , where M is 10, 20, and 100. In all examples T is taken as 1 sec.
Example – Ideal Square Wave created by thresholding 1 Hz Cosine Wave
% generate perfect square wave
t = ‐1.5:0.005:1.5; %duration of square wave xcos = cos(2*pi*t); %cosine wave of 1 Hz
xpsqw = xcos>0; %thresholding cosine wave using relational operator
figure(1); set(gcf,'defaultaxesfontsize',9); plot(t,xpsqw,'lineWidth',2); xlabel('t');
ylabel('x(t)');
title('Periodic Square Wave (T=1)');
axis([‐1.5 1.5 0.1 1.1]);
grid;
Dostları ilə paylaş: |