300 likes | 526 Views
Simulation in Digital Communication. By: Dr. Uri Mahlab. chapter # 1 Signal and Linear Systems. By: Dr. Uri Mahlab. Fourier Series. Xn - are called the Fourier series coefficients of the signal x(t). Open Matlab now. Example # 1. A. -to. to. Plot a sinc function.
E N D
Simulation in Digital Communication By: Dr. Uri Mahlab
chapter # 1 Signal and Linear Systems By: Dr. Uri Mahlab
Fourier Series Xn - are called the Fourier series coefficients of the signal x(t)
Example # 1 A -to to • Plot a sinc function. FT of ( ) x=(-10:0.1:10); plot(x,sinc(x)) grid Answer Matlab: M-file ip_01_01
Example # 2 ; A program to compute the Fourier Series Coefficients a b A Periodic Signal
A To- -to to To/2 To Example # 2.1 ; This function creates the rectangular function: x=(-3:0.1:3); % function y=rect_function(x) % y=rect_function(x) generates a rectangular signal y=(x>-1 & x<0)+(x==0)+(x>0 & x<1); plot(x,y); axis([ -5 5 -1 2]);
A To- -to to To/2 To Example # 2.2 ; This function creates the triangular function: x=(-3:0.1:3); % function y=lambda(x) % y=lambda(x) generates a triangular signal y=(x+1).*(x>-1 & x<0)+(x==0)+(-x+1).*(x>0 & x<1); plot(x,y); axis([ -5 5 -1 2]);
This function computes the Fourier Series coefficients: function=‘lambda’; a=-3; b=3; n=24; tol=0.05; xx=fseries(function,a,b,n,tol); plot(abs(xx)); A=-3; b=3; n=24; tol=0.05; xx=fseries(lambda,a,b,n,tol,p1,p2,p3); plot(abs(xx));
function xx=fseries(funfcn,a,b,n,tol,p1,p2,p3) %FSERIES Returns the Fourier series coefficients. % XX=FSERIES(FUNFCN,A,B,N,TOL,P1,P2,P3) % funfcn=The given function, in an m-file. % It can depend on up to three parameters % p1,p2, and p3. The function is given % over one period extending from 'a' to 'b' % xx=vector of length n+1 of Fourier Series % Coefficients, xx0,xx1,...,xxn. % p1,p2,p3=parameters of funfcn. % tol=the error level. j=sqrt(-1); args=[]; for nn=1:nargin-5 args=[args,',p',int2str(nn)]; end args=[args,')']; t=b-a; xx(1)=eval(['1/(',num2str(t),').*quad(funfcn,a,b,tol,[]',args]); for i=1:n newfun=['exp(-j*2*pi*x*(',int2str(i),')/(',num2str(t),')).*',funfcn]; xx(i+1)=eval(['1/(',num2str(t),').*quad(newfun,a,b,tol,[]',args]); end
Magnitude and phase spectra x=(-3:0.1:3); % function y=lambda(x) % y=lambda(x) generates a triangular signal y=(x+1).*(x>-1 & x<0)+(x==0)+(-x+1).*(x>0 & x<1); plot(x,y); axis([ -5 5 -1 2]); Determine and plot the discrete magnitude and the phase spectra of the periodic signal x(t) with a period equal 8 and defined as Answer Matlab: M-file ip_01_02
Magnitude and phase spectra # 3 Determine and plot the discrete magnitude and the phase spectra of the periodic signal x(t) with a period equal 8 and defined as Answer Matlab: M-file ip_01_03
Periodic Signal & Linear Systems Linear System
Example # 4: filtering of periodic Signals X(t) A t 1 -1 x(t) y(t) h(t) h(t) 1 1 • Determine the Fourier Series coefficients of x(t). • Plot the discrete spectrum of x(t) • Plot the discrete spectrum of the output y(t). Answer Matlab: M-file ip_01_04
Fourier transforms properties Linearity Duality Time Shift Scale
Fourier transforms properties continue Modulation Differentiation Convolution Parseval’s relation
Example # 5: Fourier Transform Plot the magnitude and the phase spectra of signals x1(t) and x2(t). x1(t) x2(t) 1 1 1 2 -1 1 Answer Matlab: M-file ip_01_05
Sampling theorem samples=(1 1 -1 2 -2 1 2); x=sinc(t+3)+sinc(t+2)-sinc(t+1)+2*sinc(t) -2*sinc(t-1)+sinc(t-2)+2*sinc(t-3); Answer sincuri.m
Example # 6:Analytical and numerical derivation of the Fourier transform X(t) 1 -2 -1 0 1 2 • Determine the Fourier transform of x(t) analytically and plot the • spectrum of x(t). • Determine the Fourier transform numerically (by Matlab) and • plot the spectrum of x(t) Answer Matlab: M-file ip_01_06
Example # 7:LTI system analysis in the frequency domain 1 1 2 X(t) h(t) -2 0 1 3 4 • Determine the FFT of the Signal • If the Signal is passed through an ideal LPF with BW of 1.5 Hz • find the output of the filter and plot it. • If the signal is passed through a filter whose impulse response is • h(t) derive the expression of the filter output. Answer Matlab: M-file ip_01_07
Power and Energy Power Spectral density
Example # 8:Power and power spectrum • The signal x(t) has a duration of 10 and is the sum of two • sinusoidal signals of unit amplitude one with frequency of • 47Hz, and the other with frequency 219hz. • The signal is Sampled at a rate of 1000 samples/sec. • Find the power content and the power spectral density for this signal Answer Matlab: M-file ip_01_08
Lowpass equivalent of bandPass Signals Analytical Signal Hilbert transform of x(t)
Envelope Phase
Matlab: M-file: analytic(x) Returns the analytic signal corresponding to signal x Matlab: M-file: loweq(x) Returns the lowpass equivalent of the signal x Matlab: M-file: quadcomp(x) Returns the in phase and quadrature components of the signal x Matlab: M-file: env_phas(x) Returns the envelope and phase of the band pass signal x
Example # 9:Bandpass to lowpass transformation • The signal x(t) is given as • Plot this signal and its magnitude spectrum. • With fo=200Hz, find the lowpass equivalent and plot its • magnitude spectrum. • Plot the in phase and the quadrature components and the envelop • of this signal • Repeat for fo=100Hz Answer Matlab: M-file ip_01_09