Вы находитесь на странице: 1из 222

# 8 CHAPTER 1 SIGNALS AND LINEAR SYSTEMS

The MA1LAB script for plotting the discrete spectrum of the signal is given below
% MATIAB .\'cript j(Jr 1/fusmmve Problem f. ChtJpter I
n"'[-201:20];
x=abs(sinc(n/2));
s!em(ll,x);
When the signal x(t) is described on one period between a and b. as shown in Figure
1.5, and the signal in the interval [a, b] is given in an m-fi!e, the Fourier series coefficients
can be obtained using them-file fseries.m given below
_.Mii"
function xx=fseries(funfcn,a,b,n,tol,p l,p2,p3)
%FSER!ES Return.< rhe Fmmer uriu coefficient.<.
% XX = FSRfS(FUNFCN.A.B.N.TOL.Pl,P2.P31
%
%
%
%
%
%
%
J=Sqrt{-1):
args"'[ ];
funfcn = The SIVefl fUnctum. '" un m.-file
It cun depend "'' up to three parameter.<
pi, pl. und p3. The func:tion 1.<
over llfl.t perwd {rom 'u' 111 'b"
xx = W'CI11r of" n + I of Frmuu Sene.<
Coefficirmt.<. xxO. x.xl. x.xn
pl. p2. pJ = pr.m1meu>r.< of
/It/ "' th<' ernw levtl
for nn=1 :nargin-5
args=[args,' , p' .int2str(nn)]:
"' :u-gs=[args, J ]:
t=b-a:
xx(1)=evnl((' 1 I ( ,num2str(t).' ) . quad r fun fen, a, b, tol . [ I .;u-gs]):
for i"'1 :n
newfun=[' exp ( -j *pi *x" ( .int2str(il. )I I '.num2str(t). l l . '.funfcn].
11 ( '.num2str(!),' ) . quad(newfun, a, b, tol. ( I .args]):
"'
lllustrative Problem 1.2 [The magnitude and the phase spectra] Determine and plot
the discrete magnitude and phase spectra of the periodic signal x (t) with a period equal to
8 and defined as x(t) = A(t) for it! :::: 4.
-+!"""'+
Since the signal is given by an m-file lambda.m, we can choose the interval (a, b]
[ -4, 4] and determine the coefficients. Note that them-file fseries.m determines the Fourier
series coefficients for nonnegative values of n, but since here x(t) is real-valued, we have
x_11 = In Figure 1.6 the magnitude and the phase spectra of this signal are plotted for
a choice of n = 24.
-----------
I .2. Fourier Sencs 9
0/ "-.......// 'ZJ
Figure 5: ...\periodic
The MATLAB .\Cripl for determinmg 3nd plotting the magnitude and the phase spectra
is given below.
_.Mii"
% MATUB "npt jol !1/u.<tmll>e Pn.blem 1. Ch<lpler I
echo on
functiOn=' lambda
a=-4;
b"'4;
n=24;
tol=0.1;
u=fseriesl funwon. a. h. n. toll.
.\Xl=xx(n+1-12);
:.:.x l=[conj(xx 1 ).xx];
absxx l =abs(xx l l:
pause % Prr.<S WIY key Ill ,,.,. d riot o/ m<l).!1.!iUde <peel!'"''
nl=[-n:n]:
stem(n l.absu I)
tule( ::he discrete spec':.r'..:..-:-, l
pha.sexxl =angle(:u l l:
pause % Prt.u uny ke_\" to <re 11 plot o/ the rlw.<r
stem(n l.phasexx 1)
tide(' the discre':.e phase spec':.rum )

Ulustrative Problem 1.3 [The magnitude and the phase spectra] Determine and plot
the magnitude and the phase spectra of a periodic signal with a period equal to 12 that is
given by
l
x(t) = __ ,- '
Jiii
in the interval I -6. 6]. A plot of this signal IS shown in Figure 1.7.