SlideShare a Scribd company logo
1 of 12
Download to read offline
MULTIMEDIA UNIVERSITY OF KENYA
FACULTY OF ENGINEERING AND TECHNOLOGY
DEPARTMENT OF ELECTRICAL AND COMMUNICATION ENGINEERING
(ECE)
BSC. TELECOMMUNICATION AND INFORMATION ENGINEERING
NAME: MARTIN WACHIYE WAFULA
REG. NO: ENG-211-075/2012
UNIT CODE: ETI 2505
UNIT NAME: DIGITAL SIGNAL PROCESSING (DSP)
LECTURER: MR. JOSIAH MAKICHE
Date of Submission: 5th
October,2016
TITLE: MATLAB ASSIGNMENT 1 - SAMPLING AND
RECONSTRUCTION OF ANALOG SIGNALS
Objectives
1. To study the sampling principle and the effect of sampling on the frequency-domain
quantities
2. To study several approaches of reconstruction
Introduction
DSP provides alternative method for processing analog signals. In DSP applications, real world
analog signals are converted into discrete signals using sampling and quantization operations
called analog-to-digital conversion or ADC. These discrete signals are processed by the digital
signal processors, and the processed output signals are converted into analog signal using a
reconstruction operation called digital-to-analog conversion or DAC.
Fig1: Block diagram of a digital signal processing system
The relationship between an analog signal and its discrete time sampled version is necessary to
understand the operation of DSP system. This relationship in time domain is given by:
x(n) = xa (nTs)
where Ts is the sampling interval. This relation can also be shown in the frequency domain using
the Fourier analysis.
The continuous time Fourier transform is given by 



 dtetxFX Ftj
aa
2
)()( .
The inverse continuous time Fourier transform is given by 


 dFeFXtx Ftj
aa
2
)()( .
The discrete time Fourier transform is given by 




n
fnj
enxfX 2
)()( .
The inverse discrete time Fourier transform is given by 


 dFeFXtx Ftj
aa
2
)()( .
The relation between Xa(F) and X(f) is given by 



k
sas FkfXFfX ))(()( .
where Fs is a sampling frequency = 1/Ts. In other words, X(f) consists of infinite numbers of
copies of scaled Xa(F) separated by frequency interval f = 1. From the relation between discrete
time and analog frequencies
sF
F
f 
we get




k
sas
s
kFFXF
F
F
X )()(
in which )(
sF
F
X consists of infinite numbers of copies of scaled Xa(F) separated by interval F =
Fs.
Sampling Principle
To avoid aliasing, a band-limited signal xa(t) with bandwidth B can be reconstructed from
its sample values x(n) = xa(nTs) if the sampling frequency Fs = 1/Ts is greater than twice the
bandwidth B of xa(t).
BFs 2
Otherwise aliasing would result in x(n). The sampling rate of 2B for an analog band-limited
signal is called the Nyquist rate.
Reconstruction
From the sampling theorem and the above examples it is clear that if we sample band-
limited xa(t) above its Nyquist rate, then we can reconstruct xa(t) from its samples
x(n). Using an interpolation formula:
))((sinc)()( ss
n
a nTtFnxtx  


where
x
x
x

 )sin(
)(sinc  is an interpolating function derived from an ideal low pass
reconstruction filter. However, since an ideal low pass reconstruction filter cannot be
implemented, we usually estimated the ideal low pass filter by the following methods:
 Zero-order-hold (ZOH) interpolation: In this interpolation a given sample value is held
for the sample interval until the next sample is received.
( ) ( ), ( 1)a s sx t x n nT t n T   
which can be obtained by filtering the impulse train through an interpolating filter of the
form
s
0
1 0 t<T
( )
0 otherwise
h t

 

which is a rectangular pulse. The resulting signal is a piecewise-constant (staircase)
waveform which requires an appropriately designed analog post-filter for accurate
waveform reconstruction.
x(n)   xa(t)   xa(t)
 First-order-hold (FOH) interpolation: In this case the adjacent samples are joined by
straight lines. This can be obtained by filtering the impulse train through
s
1
1 0
( )
1 2
0 otherwise
s
s s
s
t
t T
T
h t t
T t T
T

  

    


Procedure
1. Sampling xa (t) at Fs = 50 samples/sec
ZOH Post-Filter
1. %xa(t)= exp(-10|t|)
2. %CTFT is given by Xa(F) =
[(2*10)/(10^2 + (2*pi*F)^2)]
3. %sampling xa(t) at Fs = 50
samples/sec
4. clear all
5. tmin = -1;
6. tmax = 1;
7. %Analog signal
8. t = tmin: 0.001: tmax;
9. xa = exp(-10*abs(t));
10. %Sampling
rate(sample/second)
11. Fs = 50;
12. %Sample period
13. Ts = 1/Fs;
14. %Discrete time signal
15. n = tmin/Ts:tmax/Ts;
16. x = exp(-10*abs(n*Ts));
17. %Display signal in time
domain
18. figure(1)
19. subplot(211)
20. plot(t,xa)
21. title('Analog and
Discrete Time Signals')
22. xlabel('time(sec)')
23. ylabel('Analog Signal
x(t)')
24. subplot(212)
25. stem(n,x)
26. xlabel('n')
27. ylabel('Discrete time
signal x(n)')
28. %Computing FT
29. %Analog frequency (Hz)
30. F = -100:0.1:100;
31. W = (2*pi*F);
32. %DT Frequency
(circles/sample)
33. f = F/Fs;
34. w = 2*pi*f;
35. %Analog spectrum for
CTFT
36. XaF = 2.*(10./(10^2+
W.^2));
37. %DTFT
38. XF = x * exp(-1i*n'*w);
39. %Display spectra in
frequency domain
40. figure(2)
41. subplot(311)
42. plot(F,abs(XaF))
43. title('spectra of
signals')
44. xlabel('Freq(circle/sec
)')
45. ylabel('Original
Xa(F)')
46. subplot(312)
47. plot(F,abs(XF))
48. xlabel('Freq(circle/sec
)')
49. ylabel('X(F/Fs)')
50. subplot(313)
51. plot(f,abs(XF))
52. xlabel('Freq(circle/sec
)')
53. ylabel('X(f)')
54. %Display spectra in the
fundamental range
55. figure(3)
56. subplot(211)
57. plot(F,abs(XaF))
58. plot(F,abs(XF))
59. title('spectra in the
fundamental range')
60. xlabel('Freq(circle/sec
)')
61. ylabel('X(F/Fs)')
62. v = axis;
63. v(1:2) = [-Fs/2 Fs/2];
64. axis(v)
65. subplot(212)
66. plot(f,abs(XF))
67. xlabel('Freq(circle/sec
)')
68. ylabel('X(f)')
69. v = axis;
70. v(1:2) = [-1/2 1/2];
71. axis(v)
Experimental results
Explanation:
We have superimposed the discrete signal x(n) over x(t) to emphasize the sampling. The plot
shows that it is a scaled version (scaled by Fs = 50) of X(F). Clearly there is no aliasing.
Q2. Reconstruction of xa(t)
72. %Reconstruction of
xa(t)
73. t = tmin:0.001:tmax;
74. figure(4)
75. clf
76. subplot(211)
77. hold on
78. stem(n*Ts,x,'r')
79. for i= 1:size(x,2)
80. xsinc(i,:) =
x(i)*sinc(Fs*(t-(i+min(n)-
1)*Ts));
81. plot(t,xsinc(i,:))
82. end
83. title('Signal
reconstruction')
84. xlabel('time(second)')
85. ylabel('x(n)*Sinc(Fs*(t
-nTs))')
86. hold off
87. xar = sum(xsinc);
88. subplot(212)
89. plot(t,xar,'b-
',t,xa,'r:')
90.
91. legend('Reconstructed
signal','Origin signal')
92. ylabel('Reconstructed
signal xa(t)')
93.
94. xlabel('time (second)')
95. %reconstruction error
96. maxerror = max(abs(xa-
xar));
Experimental Results
Explanation:
The maximum error between the reconstructed and the actual analog signal is 0.0380. This is
because xa(t) is not strictly band-limited and we also have a finite number of samples. From the
reconstructed figure above, we note that visually the reconstruction is excellent.
Q3. For Fs = 10 samples/cycle, the results are as shown below:
Explanation:
Here Fs = 10 < 20. There is considerable amount of aliasing. From the figure above, this is
evident since shape of x(n) is different from that of Xa(F) and can be seen as adding overlapping
replicas of Xa(F).
Explanation:
The maximum error between the reconstructed and the actual analog signals is 0.1852, which is
significant and cannot be attributed to the nonband-limitedness of xa(t) alone. From Figure
above, the reconstructed signal differs from the actual one in many places over the interpolated
regions. This is the visual demonstration of aliasing in the time domain. (Proakis, 2012)
Reason why Fs = 50 samples/sec is better than Fs = 10 samples/sec:
- Since the bandwidth of xa(t) = 20Hz, the Nyquist rate Fo = 40 Hz according to the
Sampling theorem. To prevent aliasing, the analog signal should be sampled at a rate
higher than twice the highest frequency in the analog signal.
- Therefore, for Fs = 50 Hz > Fo there is no aliasing hence better compared Fs = 10
samples/sec < Fo . (Manolakis, 1996)
Q4. xa(t) = sin(20πt), 0≤ t ≤ 1. Samples at Ts = 0.01, 0.03, 0.05, 0.07 and 0.1
a) For each Ts, x(n) was plotted.
MATLAB Code
1. tmin = 0;
2. tmax = 1;
3. %Analog signal
4. t = tmin: 0.001: tmax;
5. xa = sin(20*pi*t);
6. %Sample period
7. Ts1 = .01;
8. %Discrete time signal
9. n1 = tmin/Ts1:tmax/Ts1;
10. x1 = sin(20*pi*n1*Ts1);
11. %Display signal in time
domain
12. figure(5)
13. subplot(211)
14. plot(t,xa)
15. title('Analog and
Discrete Time Signals')
16. xlabel('time(sec)')
17. ylabel('Analog Signal
x(t)')
18. subplot(212)
19. stem(n1,x)
20. xlabel('n1')
21. ylabel('Discrete time
signal x1(n)')
22. Ts2 = .03;
23. %Discrete time signal
24. n2 = tmin/Ts2:tmax/Ts2;
25. x2 = sin(20*pi*n2*Ts2);
26. %Display signal in time
domain
27. figure(6)
28. subplot(211)
29. plot(t,xa)
30. title('Analog and
Discrete Time Signals')
31. xlabel('time(sec)')
32. ylabel('Analog Signal
x(t)')
33. subplot(212)
34. stem(n2,x2)
35. xlabel('n2')
36. ylabel('Discrete time
signal x2(n)')
37. Ts3 = .05;
38. %Discrete time signal
39. n3 = tmin/Ts3:tmax/Ts3;
40. x3 = sin(20*pi*n3*Ts3);
41. %Display signal in time
domain
42. figure(7)
43. subplot(211)
44. plot(t,xa)
45. title('Analog and
Discrete Time Signals')
46. xlabel('time(sec)')
47. ylabel('Analog Signal
x(t)')
48. subplot(212)
49. stem(n3,x3)
50. xlabel('n3')
51. ylabel('Discrete time
signal x3(n)')
52. Ts4 = .07;
53. %Discrete time signal
54. n4 = tmin/Ts4:tmax/Ts4;
55. x4 = sin(20*pi*n4*Ts4);
56. %Display signal in time
domain
57. figure(8)
58. subplot(211)
59. plot(t,xa)
60. title('Analog and
Discrete Time Signals')
61. xlabel('time(sec)')
62. ylabel('Analog Signal
x(t)')
63. subplot(212)
64. stem(n4,x4)
65. xlabel('n4')
66. ylabel('Discrete time
signal x4(n)')
67. Ts5 = .1;
68. %Discrete time signal
69. n5 = tmin/Ts5:tmax/Ts5;
70. x5 = sin(20*pi*n5*Ts5);
71. %Display signal in time
domain
72. figure(9)
73. subplot(211)
74. plot(t,xa)
75. title('Analog and
Discrete Time Signals')
76. xlabel('time(sec)')
77. ylabel('Analog Signal
x(t)')
78. subplot(212)
79. stem(n5,x5)
80. xlabel('n5')
81. ylabel('Discrete time
signal x5(n)')
For Ts = 0.01, figure 5, Ts = 0.03 figure 6, Ts = 0.05 figure 7, Ts = 0.07 figure 8 and Ts = 0.1
figure 9 were plotted.
(b) Reconstruction of ya(t) code (Proakis, 2012)
(c) Results
The maximum error between the reconstructed and the actual analog signal is 0.0013. This is
because xa(t) is not strictly band-limited and there is a finite number of samples. From the
reconstructed figure above, we note that visually the reconstruction is excellent.
QUESTIONS
1. What is the MATLAB function that would be used to plot a staircase (ZOH) interpolation
of the analog signal?
stairs(n * Ts * frequency, x);
hold on
stem(n* Ts * frequency, x);
hold off
(Proakis, 2012)
2. What is the MATLAB function that would be used to plot a staircase (ZOH) interpolation
of the analog signal?
plot(n * Ts * frequency, x);
hold on
stem(n* Ts * frequency, x);
hold off
(Proakis, 2012)
3. From the experiment, describe why minimum sampling rate must be at least twice the
bandwidth of an analog signal?
To avoid aliasing
Explanation of the function of each part of DSP system above:
ADC - The output of the A /D converter is a digital signal that is appropriate as an input to the
digital processor. ADC coverts continuous time signal into discrete time signals through
sampling and quantization
The digital signal processor- may be a large programmable digital computer or a small
microprocessor programmed to perform the desired operations on the input signal. It may also be
a hard wired digital processor configured to perform a specified set of operations on the input
signal.
DAC – converts the digital output of the processor into analog signal. This is called
reconstruction.(Manolakis, 1996)
References
Manolakis, J. G. (1996). Digital Signal Processing - Principles, Algorithms and Applications (Third ed.).
New Jersey, USA: Prentice Hall International-Inc.
Proakis, V. K. (2012). DIGITAL SIGNAL PROCESSING USING MATLAB (3rd ed.). Stamford, USA: Cengage
Learning.

More Related Content

What's hot

Introduction of digital communication
Introduction of digital communicationIntroduction of digital communication
Introduction of digital communicationasodariyabhavesh
 
Introduction to DSP.ppt
Introduction to DSP.pptIntroduction to DSP.ppt
Introduction to DSP.pptDr.YNM
 
Classification of signals
Classification of signalsClassification of signals
Classification of signalschitra raju
 
Signal and System, CT Signal DT Signal, Signal Processing(amplitude and time ...
Signal and System, CT Signal DT Signal, Signal Processing(amplitude and time ...Signal and System, CT Signal DT Signal, Signal Processing(amplitude and time ...
Signal and System, CT Signal DT Signal, Signal Processing(amplitude and time ...Waqas Afzal
 
DIGITAL SIGNAL PROCESSING BASED ON MATLAB
DIGITAL SIGNAL PROCESSING BASED ON MATLABDIGITAL SIGNAL PROCESSING BASED ON MATLAB
DIGITAL SIGNAL PROCESSING BASED ON MATLABPrashant Srivastav
 
Digital communication
Digital communicationDigital communication
Digital communicationmeashi
 
Decimation and Interpolation
Decimation and InterpolationDecimation and Interpolation
Decimation and InterpolationFernando Ojeda
 
Digital Signal Processing[ECEG-3171]-Ch1_L03
Digital Signal Processing[ECEG-3171]-Ch1_L03Digital Signal Processing[ECEG-3171]-Ch1_L03
Digital Signal Processing[ECEG-3171]-Ch1_L03Rediet Moges
 
Introduction to Analog signal
Introduction to Analog signalIntroduction to Analog signal
Introduction to Analog signalHirdesh Vishwdewa
 
Signals & Systems PPT
Signals & Systems PPTSignals & Systems PPT
Signals & Systems PPTJay Baria
 
Introduction to wavelet transform
Introduction to wavelet transformIntroduction to wavelet transform
Introduction to wavelet transformRaj Endiran
 
Signal classification of signal
Signal classification of signalSignal classification of signal
Signal classification of signal001Abhishek1
 
1.introduction to signals
1.introduction to signals1.introduction to signals
1.introduction to signalsINDIAN NAVY
 
Chapter1 - Signal and System
Chapter1 - Signal and SystemChapter1 - Signal and System
Chapter1 - Signal and SystemAttaporn Ninsuwan
 
M ary psk modulation
M ary psk modulationM ary psk modulation
M ary psk modulationAhmed Diaa
 

What's hot (20)

Introduction of digital communication
Introduction of digital communicationIntroduction of digital communication
Introduction of digital communication
 
Introduction to DSP.ppt
Introduction to DSP.pptIntroduction to DSP.ppt
Introduction to DSP.ppt
 
Multirate DSP
Multirate DSPMultirate DSP
Multirate DSP
 
Classification of signals
Classification of signalsClassification of signals
Classification of signals
 
Signal and System, CT Signal DT Signal, Signal Processing(amplitude and time ...
Signal and System, CT Signal DT Signal, Signal Processing(amplitude and time ...Signal and System, CT Signal DT Signal, Signal Processing(amplitude and time ...
Signal and System, CT Signal DT Signal, Signal Processing(amplitude and time ...
 
Sampling Theorem
Sampling TheoremSampling Theorem
Sampling Theorem
 
DIGITAL SIGNAL PROCESSING BASED ON MATLAB
DIGITAL SIGNAL PROCESSING BASED ON MATLABDIGITAL SIGNAL PROCESSING BASED ON MATLAB
DIGITAL SIGNAL PROCESSING BASED ON MATLAB
 
Digital communication
Digital communicationDigital communication
Digital communication
 
Butterworth filter
Butterworth filterButterworth filter
Butterworth filter
 
Signals & systems
Signals & systems Signals & systems
Signals & systems
 
Decimation and Interpolation
Decimation and InterpolationDecimation and Interpolation
Decimation and Interpolation
 
Digital Signal Processing[ECEG-3171]-Ch1_L03
Digital Signal Processing[ECEG-3171]-Ch1_L03Digital Signal Processing[ECEG-3171]-Ch1_L03
Digital Signal Processing[ECEG-3171]-Ch1_L03
 
Introduction to Analog signal
Introduction to Analog signalIntroduction to Analog signal
Introduction to Analog signal
 
Dsp ppt
Dsp pptDsp ppt
Dsp ppt
 
Signals & Systems PPT
Signals & Systems PPTSignals & Systems PPT
Signals & Systems PPT
 
Introduction to wavelet transform
Introduction to wavelet transformIntroduction to wavelet transform
Introduction to wavelet transform
 
Signal classification of signal
Signal classification of signalSignal classification of signal
Signal classification of signal
 
1.introduction to signals
1.introduction to signals1.introduction to signals
1.introduction to signals
 
Chapter1 - Signal and System
Chapter1 - Signal and SystemChapter1 - Signal and System
Chapter1 - Signal and System
 
M ary psk modulation
M ary psk modulationM ary psk modulation
M ary psk modulation
 

Similar to DIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLAB

Matlab 2
Matlab 2Matlab 2
Matlab 2asguna
 
signal homework
signal homeworksignal homework
signal homeworksokok22867
 
Digital Signal Processing[ECEG-3171]-Ch1_L05
Digital Signal Processing[ECEG-3171]-Ch1_L05Digital Signal Processing[ECEG-3171]-Ch1_L05
Digital Signal Processing[ECEG-3171]-Ch1_L05Rediet Moges
 
pulse modulation technique (Pulse code modulation).pptx
pulse modulation technique (Pulse code modulation).pptxpulse modulation technique (Pulse code modulation).pptx
pulse modulation technique (Pulse code modulation).pptxNishanth Asmi
 
Pulse Modulation ppt
Pulse Modulation pptPulse Modulation ppt
Pulse Modulation pptsanjeev2419
 
Sampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptxSampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptxHamzaJaved306957
 
Ch7 noise variation of different modulation scheme pg 63
Ch7 noise variation of different modulation scheme pg 63Ch7 noise variation of different modulation scheme pg 63
Ch7 noise variation of different modulation scheme pg 63Prateek Omer
 
Ch6 digital transmission of analog signal pg 99
Ch6 digital transmission of analog signal pg 99Ch6 digital transmission of analog signal pg 99
Ch6 digital transmission of analog signal pg 99Prateek Omer
 
Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01Rimple Mahey
 
Digitla Communication pulse shaping filter
Digitla Communication pulse shaping filterDigitla Communication pulse shaping filter
Digitla Communication pulse shaping filtermirfanjum
 
Module1_dsffffffffffffffffffffgggpa.pptx
Module1_dsffffffffffffffffffffgggpa.pptxModule1_dsffffffffffffffffffffgggpa.pptx
Module1_dsffffffffffffffffffffgggpa.pptxrealme6igamerr
 
Introduction to Signal Processing Orfanidis [Solution Manual]
Introduction to Signal Processing Orfanidis [Solution Manual]Introduction to Signal Processing Orfanidis [Solution Manual]
Introduction to Signal Processing Orfanidis [Solution Manual]slyhamm
 
CHƯƠNG 2 KỸ THUẬT TRUYỀN DẪN SỐ - THONG TIN SỐ
CHƯƠNG 2 KỸ THUẬT TRUYỀN DẪN SỐ - THONG TIN SỐCHƯƠNG 2 KỸ THUẬT TRUYỀN DẪN SỐ - THONG TIN SỐ
CHƯƠNG 2 KỸ THUẬT TRUYỀN DẪN SỐ - THONG TIN SỐlykhnh386525
 
Dsp gcu lab11
Dsp gcu lab11Dsp gcu lab11
Dsp gcu lab11Jannat41
 
On The Fundamental Aspects of Demodulation
On The Fundamental Aspects of DemodulationOn The Fundamental Aspects of Demodulation
On The Fundamental Aspects of DemodulationCSCJournals
 

Similar to DIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLAB (20)

DSP Lab 1-6.pdf
DSP Lab 1-6.pdfDSP Lab 1-6.pdf
DSP Lab 1-6.pdf
 
Dsp Lab Record
Dsp Lab RecordDsp Lab Record
Dsp Lab Record
 
Matlab 2
Matlab 2Matlab 2
Matlab 2
 
signal homework
signal homeworksignal homework
signal homework
 
Digital Signal Processing[ECEG-3171]-Ch1_L05
Digital Signal Processing[ECEG-3171]-Ch1_L05Digital Signal Processing[ECEG-3171]-Ch1_L05
Digital Signal Processing[ECEG-3171]-Ch1_L05
 
pulse modulation technique (Pulse code modulation).pptx
pulse modulation technique (Pulse code modulation).pptxpulse modulation technique (Pulse code modulation).pptx
pulse modulation technique (Pulse code modulation).pptx
 
Pulse Modulation ppt
Pulse Modulation pptPulse Modulation ppt
Pulse Modulation ppt
 
Sampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptxSampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptx
 
Dsp manual
Dsp manualDsp manual
Dsp manual
 
Ch7 noise variation of different modulation scheme pg 63
Ch7 noise variation of different modulation scheme pg 63Ch7 noise variation of different modulation scheme pg 63
Ch7 noise variation of different modulation scheme pg 63
 
Ch6 digital transmission of analog signal pg 99
Ch6 digital transmission of analog signal pg 99Ch6 digital transmission of analog signal pg 99
Ch6 digital transmission of analog signal pg 99
 
Unit 8
Unit 8Unit 8
Unit 8
 
Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01
 
Digitla Communication pulse shaping filter
Digitla Communication pulse shaping filterDigitla Communication pulse shaping filter
Digitla Communication pulse shaping filter
 
unit 4,5 (1).docx
unit 4,5 (1).docxunit 4,5 (1).docx
unit 4,5 (1).docx
 
Module1_dsffffffffffffffffffffgggpa.pptx
Module1_dsffffffffffffffffffffgggpa.pptxModule1_dsffffffffffffffffffffgggpa.pptx
Module1_dsffffffffffffffffffffgggpa.pptx
 
Introduction to Signal Processing Orfanidis [Solution Manual]
Introduction to Signal Processing Orfanidis [Solution Manual]Introduction to Signal Processing Orfanidis [Solution Manual]
Introduction to Signal Processing Orfanidis [Solution Manual]
 
CHƯƠNG 2 KỸ THUẬT TRUYỀN DẪN SỐ - THONG TIN SỐ
CHƯƠNG 2 KỸ THUẬT TRUYỀN DẪN SỐ - THONG TIN SỐCHƯƠNG 2 KỸ THUẬT TRUYỀN DẪN SỐ - THONG TIN SỐ
CHƯƠNG 2 KỸ THUẬT TRUYỀN DẪN SỐ - THONG TIN SỐ
 
Dsp gcu lab11
Dsp gcu lab11Dsp gcu lab11
Dsp gcu lab11
 
On The Fundamental Aspects of Demodulation
On The Fundamental Aspects of DemodulationOn The Fundamental Aspects of Demodulation
On The Fundamental Aspects of Demodulation
 

More from Martin Wachiye Wafula

More from Martin Wachiye Wafula (11)

Introduction to information theory
Introduction to information theoryIntroduction to information theory
Introduction to information theory
 
Intelligent reflecting surfaces (IRS)
Intelligent reflecting surfaces  (IRS)Intelligent reflecting surfaces  (IRS)
Intelligent reflecting surfaces (IRS)
 
ELECTRONIC MANAGEMENT SYSTEM BASED ON RFID AND USSD
ELECTRONIC MANAGEMENT SYSTEM BASED ON RFID AND USSDELECTRONIC MANAGEMENT SYSTEM BASED ON RFID AND USSD
ELECTRONIC MANAGEMENT SYSTEM BASED ON RFID AND USSD
 
Disruptive technologies and market place
Disruptive technologies and market placeDisruptive technologies and market place
Disruptive technologies and market place
 
5G: LET'S DEMYSTIFY IT, 5G Technology Update
5G: LET'S DEMYSTIFY IT, 5G Technology Update5G: LET'S DEMYSTIFY IT, 5G Technology Update
5G: LET'S DEMYSTIFY IT, 5G Technology Update
 
Analog filters matlab_examples
Analog filters matlab_examplesAnalog filters matlab_examples
Analog filters matlab_examples
 
Matlab task1
Matlab task1Matlab task1
Matlab task1
 
Matlab problems
Matlab problemsMatlab problems
Matlab problems
 
Discrete time signals on MATLAB
Discrete time signals on MATLABDiscrete time signals on MATLAB
Discrete time signals on MATLAB
 
Discrete time signals on MATLAB
Discrete time signals on MATLABDiscrete time signals on MATLAB
Discrete time signals on MATLAB
 
Unity in diversity
Unity in diversityUnity in diversity
Unity in diversity
 

Recently uploaded

Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
Rums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfRums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfsmsksolar
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stageAbc194748
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086anil_gaur
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...soginsider
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...Health
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 

Recently uploaded (20)

Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Rums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfRums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdf
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stage
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 

DIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLAB

  • 1. MULTIMEDIA UNIVERSITY OF KENYA FACULTY OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ELECTRICAL AND COMMUNICATION ENGINEERING (ECE) BSC. TELECOMMUNICATION AND INFORMATION ENGINEERING NAME: MARTIN WACHIYE WAFULA REG. NO: ENG-211-075/2012 UNIT CODE: ETI 2505 UNIT NAME: DIGITAL SIGNAL PROCESSING (DSP) LECTURER: MR. JOSIAH MAKICHE Date of Submission: 5th October,2016 TITLE: MATLAB ASSIGNMENT 1 - SAMPLING AND RECONSTRUCTION OF ANALOG SIGNALS
  • 2. Objectives 1. To study the sampling principle and the effect of sampling on the frequency-domain quantities 2. To study several approaches of reconstruction Introduction DSP provides alternative method for processing analog signals. In DSP applications, real world analog signals are converted into discrete signals using sampling and quantization operations called analog-to-digital conversion or ADC. These discrete signals are processed by the digital signal processors, and the processed output signals are converted into analog signal using a reconstruction operation called digital-to-analog conversion or DAC. Fig1: Block diagram of a digital signal processing system The relationship between an analog signal and its discrete time sampled version is necessary to understand the operation of DSP system. This relationship in time domain is given by: x(n) = xa (nTs) where Ts is the sampling interval. This relation can also be shown in the frequency domain using the Fourier analysis. The continuous time Fourier transform is given by      dtetxFX Ftj aa 2 )()( . The inverse continuous time Fourier transform is given by     dFeFXtx Ftj aa 2 )()( . The discrete time Fourier transform is given by      n fnj enxfX 2 )()( . The inverse discrete time Fourier transform is given by     dFeFXtx Ftj aa 2 )()( . The relation between Xa(F) and X(f) is given by     k sas FkfXFfX ))(()( .
  • 3. where Fs is a sampling frequency = 1/Ts. In other words, X(f) consists of infinite numbers of copies of scaled Xa(F) separated by frequency interval f = 1. From the relation between discrete time and analog frequencies sF F f  we get     k sas s kFFXF F F X )()( in which )( sF F X consists of infinite numbers of copies of scaled Xa(F) separated by interval F = Fs. Sampling Principle To avoid aliasing, a band-limited signal xa(t) with bandwidth B can be reconstructed from its sample values x(n) = xa(nTs) if the sampling frequency Fs = 1/Ts is greater than twice the bandwidth B of xa(t). BFs 2 Otherwise aliasing would result in x(n). The sampling rate of 2B for an analog band-limited signal is called the Nyquist rate. Reconstruction From the sampling theorem and the above examples it is clear that if we sample band- limited xa(t) above its Nyquist rate, then we can reconstruct xa(t) from its samples x(n). Using an interpolation formula: ))((sinc)()( ss n a nTtFnxtx     where x x x   )sin( )(sinc  is an interpolating function derived from an ideal low pass reconstruction filter. However, since an ideal low pass reconstruction filter cannot be implemented, we usually estimated the ideal low pass filter by the following methods:  Zero-order-hold (ZOH) interpolation: In this interpolation a given sample value is held for the sample interval until the next sample is received. ( ) ( ), ( 1)a s sx t x n nT t n T    which can be obtained by filtering the impulse train through an interpolating filter of the form
  • 4. s 0 1 0 t<T ( ) 0 otherwise h t     which is a rectangular pulse. The resulting signal is a piecewise-constant (staircase) waveform which requires an appropriately designed analog post-filter for accurate waveform reconstruction. x(n)   xa(t)   xa(t)  First-order-hold (FOH) interpolation: In this case the adjacent samples are joined by straight lines. This can be obtained by filtering the impulse train through s 1 1 0 ( ) 1 2 0 otherwise s s s s t t T T h t t T t T T             Procedure 1. Sampling xa (t) at Fs = 50 samples/sec ZOH Post-Filter
  • 5. 1. %xa(t)= exp(-10|t|) 2. %CTFT is given by Xa(F) = [(2*10)/(10^2 + (2*pi*F)^2)] 3. %sampling xa(t) at Fs = 50 samples/sec 4. clear all 5. tmin = -1; 6. tmax = 1; 7. %Analog signal 8. t = tmin: 0.001: tmax; 9. xa = exp(-10*abs(t)); 10. %Sampling rate(sample/second) 11. Fs = 50; 12. %Sample period 13. Ts = 1/Fs; 14. %Discrete time signal 15. n = tmin/Ts:tmax/Ts; 16. x = exp(-10*abs(n*Ts)); 17. %Display signal in time domain 18. figure(1) 19. subplot(211) 20. plot(t,xa) 21. title('Analog and Discrete Time Signals') 22. xlabel('time(sec)') 23. ylabel('Analog Signal x(t)') 24. subplot(212) 25. stem(n,x) 26. xlabel('n') 27. ylabel('Discrete time signal x(n)') 28. %Computing FT 29. %Analog frequency (Hz) 30. F = -100:0.1:100; 31. W = (2*pi*F); 32. %DT Frequency (circles/sample) 33. f = F/Fs; 34. w = 2*pi*f; 35. %Analog spectrum for CTFT 36. XaF = 2.*(10./(10^2+ W.^2)); 37. %DTFT 38. XF = x * exp(-1i*n'*w); 39. %Display spectra in frequency domain 40. figure(2) 41. subplot(311) 42. plot(F,abs(XaF)) 43. title('spectra of signals') 44. xlabel('Freq(circle/sec )') 45. ylabel('Original Xa(F)') 46. subplot(312) 47. plot(F,abs(XF)) 48. xlabel('Freq(circle/sec )') 49. ylabel('X(F/Fs)') 50. subplot(313) 51. plot(f,abs(XF)) 52. xlabel('Freq(circle/sec )') 53. ylabel('X(f)') 54. %Display spectra in the fundamental range 55. figure(3) 56. subplot(211) 57. plot(F,abs(XaF)) 58. plot(F,abs(XF)) 59. title('spectra in the fundamental range') 60. xlabel('Freq(circle/sec )') 61. ylabel('X(F/Fs)') 62. v = axis; 63. v(1:2) = [-Fs/2 Fs/2]; 64. axis(v) 65. subplot(212) 66. plot(f,abs(XF)) 67. xlabel('Freq(circle/sec )') 68. ylabel('X(f)') 69. v = axis; 70. v(1:2) = [-1/2 1/2]; 71. axis(v) Experimental results
  • 6. Explanation: We have superimposed the discrete signal x(n) over x(t) to emphasize the sampling. The plot shows that it is a scaled version (scaled by Fs = 50) of X(F). Clearly there is no aliasing. Q2. Reconstruction of xa(t) 72. %Reconstruction of xa(t) 73. t = tmin:0.001:tmax; 74. figure(4) 75. clf 76. subplot(211) 77. hold on 78. stem(n*Ts,x,'r') 79. for i= 1:size(x,2) 80. xsinc(i,:) = x(i)*sinc(Fs*(t-(i+min(n)- 1)*Ts)); 81. plot(t,xsinc(i,:)) 82. end 83. title('Signal reconstruction') 84. xlabel('time(second)') 85. ylabel('x(n)*Sinc(Fs*(t -nTs))') 86. hold off 87. xar = sum(xsinc); 88. subplot(212) 89. plot(t,xar,'b- ',t,xa,'r:') 90. 91. legend('Reconstructed signal','Origin signal') 92. ylabel('Reconstructed signal xa(t)') 93. 94. xlabel('time (second)') 95. %reconstruction error 96. maxerror = max(abs(xa- xar)); Experimental Results
  • 7. Explanation: The maximum error between the reconstructed and the actual analog signal is 0.0380. This is because xa(t) is not strictly band-limited and we also have a finite number of samples. From the reconstructed figure above, we note that visually the reconstruction is excellent. Q3. For Fs = 10 samples/cycle, the results are as shown below:
  • 8. Explanation: Here Fs = 10 < 20. There is considerable amount of aliasing. From the figure above, this is evident since shape of x(n) is different from that of Xa(F) and can be seen as adding overlapping replicas of Xa(F). Explanation: The maximum error between the reconstructed and the actual analog signals is 0.1852, which is significant and cannot be attributed to the nonband-limitedness of xa(t) alone. From Figure above, the reconstructed signal differs from the actual one in many places over the interpolated regions. This is the visual demonstration of aliasing in the time domain. (Proakis, 2012) Reason why Fs = 50 samples/sec is better than Fs = 10 samples/sec: - Since the bandwidth of xa(t) = 20Hz, the Nyquist rate Fo = 40 Hz according to the Sampling theorem. To prevent aliasing, the analog signal should be sampled at a rate higher than twice the highest frequency in the analog signal. - Therefore, for Fs = 50 Hz > Fo there is no aliasing hence better compared Fs = 10 samples/sec < Fo . (Manolakis, 1996) Q4. xa(t) = sin(20πt), 0≤ t ≤ 1. Samples at Ts = 0.01, 0.03, 0.05, 0.07 and 0.1 a) For each Ts, x(n) was plotted. MATLAB Code 1. tmin = 0; 2. tmax = 1; 3. %Analog signal 4. t = tmin: 0.001: tmax; 5. xa = sin(20*pi*t); 6. %Sample period 7. Ts1 = .01; 8. %Discrete time signal 9. n1 = tmin/Ts1:tmax/Ts1; 10. x1 = sin(20*pi*n1*Ts1); 11. %Display signal in time domain 12. figure(5) 13. subplot(211) 14. plot(t,xa)
  • 9. 15. title('Analog and Discrete Time Signals') 16. xlabel('time(sec)') 17. ylabel('Analog Signal x(t)') 18. subplot(212) 19. stem(n1,x) 20. xlabel('n1') 21. ylabel('Discrete time signal x1(n)') 22. Ts2 = .03; 23. %Discrete time signal 24. n2 = tmin/Ts2:tmax/Ts2; 25. x2 = sin(20*pi*n2*Ts2); 26. %Display signal in time domain 27. figure(6) 28. subplot(211) 29. plot(t,xa) 30. title('Analog and Discrete Time Signals') 31. xlabel('time(sec)') 32. ylabel('Analog Signal x(t)') 33. subplot(212) 34. stem(n2,x2) 35. xlabel('n2') 36. ylabel('Discrete time signal x2(n)') 37. Ts3 = .05; 38. %Discrete time signal 39. n3 = tmin/Ts3:tmax/Ts3; 40. x3 = sin(20*pi*n3*Ts3); 41. %Display signal in time domain 42. figure(7) 43. subplot(211) 44. plot(t,xa) 45. title('Analog and Discrete Time Signals') 46. xlabel('time(sec)') 47. ylabel('Analog Signal x(t)') 48. subplot(212) 49. stem(n3,x3) 50. xlabel('n3') 51. ylabel('Discrete time signal x3(n)') 52. Ts4 = .07; 53. %Discrete time signal 54. n4 = tmin/Ts4:tmax/Ts4; 55. x4 = sin(20*pi*n4*Ts4); 56. %Display signal in time domain 57. figure(8) 58. subplot(211) 59. plot(t,xa) 60. title('Analog and Discrete Time Signals') 61. xlabel('time(sec)') 62. ylabel('Analog Signal x(t)') 63. subplot(212) 64. stem(n4,x4) 65. xlabel('n4') 66. ylabel('Discrete time signal x4(n)') 67. Ts5 = .1; 68. %Discrete time signal 69. n5 = tmin/Ts5:tmax/Ts5; 70. x5 = sin(20*pi*n5*Ts5); 71. %Display signal in time domain 72. figure(9) 73. subplot(211) 74. plot(t,xa) 75. title('Analog and Discrete Time Signals') 76. xlabel('time(sec)') 77. ylabel('Analog Signal x(t)') 78. subplot(212) 79. stem(n5,x5) 80. xlabel('n5') 81. ylabel('Discrete time signal x5(n)')
  • 10. For Ts = 0.01, figure 5, Ts = 0.03 figure 6, Ts = 0.05 figure 7, Ts = 0.07 figure 8 and Ts = 0.1 figure 9 were plotted. (b) Reconstruction of ya(t) code (Proakis, 2012)
  • 11. (c) Results The maximum error between the reconstructed and the actual analog signal is 0.0013. This is because xa(t) is not strictly band-limited and there is a finite number of samples. From the reconstructed figure above, we note that visually the reconstruction is excellent. QUESTIONS 1. What is the MATLAB function that would be used to plot a staircase (ZOH) interpolation of the analog signal? stairs(n * Ts * frequency, x); hold on stem(n* Ts * frequency, x); hold off (Proakis, 2012) 2. What is the MATLAB function that would be used to plot a staircase (ZOH) interpolation of the analog signal? plot(n * Ts * frequency, x); hold on stem(n* Ts * frequency, x); hold off (Proakis, 2012) 3. From the experiment, describe why minimum sampling rate must be at least twice the bandwidth of an analog signal?
  • 12. To avoid aliasing Explanation of the function of each part of DSP system above: ADC - The output of the A /D converter is a digital signal that is appropriate as an input to the digital processor. ADC coverts continuous time signal into discrete time signals through sampling and quantization The digital signal processor- may be a large programmable digital computer or a small microprocessor programmed to perform the desired operations on the input signal. It may also be a hard wired digital processor configured to perform a specified set of operations on the input signal. DAC – converts the digital output of the processor into analog signal. This is called reconstruction.(Manolakis, 1996) References Manolakis, J. G. (1996). Digital Signal Processing - Principles, Algorithms and Applications (Third ed.). New Jersey, USA: Prentice Hall International-Inc. Proakis, V. K. (2012). DIGITAL SIGNAL PROCESSING USING MATLAB (3rd ed.). Stamford, USA: Cengage Learning.