06.06.2022 Views

B. P. Lathi, Zhi Ding - Modern Digital and Analog Communication Systems-Oxford University Press (2009)

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

52 SIGNALS AND SIGNAL SPACE

c3 =

0.9614

c4 =

0.6282

c5

8.6748e-17

Numerical Computation of Coefficients D n

There are several ways to numerically compute the Fourier series coefficients D n , We will use

MATLAB to show how to use numerical integration in the evaluation of Fourier series.

To carry out a direct numerical integration of Eq. (2.60), the first step is to define the

symbolic expression of the signal g(t) under analysis. We use the triangle function (t) in the

following example.

% (funct_tri .m)

% A standard triangle function of base - 1 to 1

function y = funct_tri (t)

% Usage y = func_tri (t)

% t = input variable i

y= ( (t> -1)-(t>l) ) . * (1-abs (t));

Once the file funct _ tri .m defines the function y = g(t), we can directl y carry

out the necessary integration of Eq. (2.60) for a finite number of Fourier series coefficients

{Dn, n = -N, ... , -1, 0, 1, ... , N}. We provide the following MATLAB program called

FSexample .m to evaluate the Fourier series of t,,(t/2) with period [a, b] (a = -2, b = 2).

In this example, N = 11 is selected. Executing this short program in MATLAB will generate

Fig. 2.22 with both amplitude and angle of D ,, .

% (file name : FSexp_a .m)

% This example shows how to numerically evaluate

% the exponential Fourier series coefficients Dn

% directly .

% The user needs to define a symbolic function

% g(t) . In this example, g(t)= funct_tri (t) .

echo off; clear; elf;

j=sqrt (-1) ; % Define j for complex algebra

b=2 ; a=-2 ;

tol=l .e-5;

T=b-a;

N=l l;

% Determine one signal period

% Set integration error tolerance

% length of the period

% Number of FS coefficients

% on each side of zero frequency

Fi= [-N:N] *2*pi/T; % Set frequency range

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!