SlideShare a Scribd company logo
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

parametric method of power spectrum Estimation
parametric method of power spectrum Estimationparametric method of power spectrum Estimation
parametric method of power spectrum Estimation
junjer
 
8-PSK(Digital Communication Technique)
8-PSK(Digital Communication Technique)8-PSK(Digital Communication Technique)
8-PSK(Digital Communication Technique)
SOBITAMARNATH
 
Properties of dft
Properties of dftProperties of dft
Properties of dft
tamil arasan
 
Sampling Theorem
Sampling TheoremSampling Theorem
Sampling Theorem
Dr Naim R Kidwai
 
Discrete-Time Signal Processing
Discrete-Time Signal ProcessingDiscrete-Time Signal Processing
Discrete-Time Signal Processing
lancer350
 
Baseband transmission
Baseband transmissionBaseband transmission
Baseband transmission
Punk Pankaj
 
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time SignalsDSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
Amr E. Mohamed
 
Digital Signal Processing[ECEG-3171]-Ch1_L02
Digital Signal Processing[ECEG-3171]-Ch1_L02Digital Signal Processing[ECEG-3171]-Ch1_L02
Digital Signal Processing[ECEG-3171]-Ch1_L02
Rediet Moges
 
Signal modelling
Signal modellingSignal modelling
Signal modellingDebangi_G
 
What is 16 qam modulation
What is 16 qam modulationWhat is 16 qam modulation
What is 16 qam modulation
FOSCO Fiber Optics
 
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
 
Introduction to wavelet transform
Introduction to wavelet transformIntroduction to wavelet transform
Introduction to wavelet transform
Raj Endiran
 
Aliasing and Antialiasing filter
Aliasing and Antialiasing filterAliasing and Antialiasing filter
Aliasing and Antialiasing filter
Suresh Mohta
 
Ppt of analog communication
Ppt of analog communicationPpt of analog communication
Ppt of analog communication
Arun Kumar
 
DSP_2018_FOEHU - Lec 04 - The z-Transform
DSP_2018_FOEHU - Lec 04 - The z-TransformDSP_2018_FOEHU - Lec 04 - The z-Transform
DSP_2018_FOEHU - Lec 04 - The z-Transform
Amr E. Mohamed
 
Equalization
EqualizationEqualization
Equalization
bhabendu
 
Random process and noise
Random process and noiseRandom process and noise
Random process and noise
Punk Pankaj
 

What's hot (20)

Chap 4
Chap 4Chap 4
Chap 4
 
parametric method of power spectrum Estimation
parametric method of power spectrum Estimationparametric method of power spectrum Estimation
parametric method of power spectrum Estimation
 
8-PSK(Digital Communication Technique)
8-PSK(Digital Communication Technique)8-PSK(Digital Communication Technique)
8-PSK(Digital Communication Technique)
 
Properties of dft
Properties of dftProperties of dft
Properties of dft
 
Sampling Theorem
Sampling TheoremSampling Theorem
Sampling Theorem
 
Discrete-Time Signal Processing
Discrete-Time Signal ProcessingDiscrete-Time Signal Processing
Discrete-Time Signal Processing
 
Baseband transmission
Baseband transmissionBaseband transmission
Baseband transmission
 
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time SignalsDSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
 
digital filters
digital filtersdigital filters
digital filters
 
Digital Signal Processing[ECEG-3171]-Ch1_L02
Digital Signal Processing[ECEG-3171]-Ch1_L02Digital Signal Processing[ECEG-3171]-Ch1_L02
Digital Signal Processing[ECEG-3171]-Ch1_L02
 
Signal modelling
Signal modellingSignal modelling
Signal modelling
 
What is 16 qam modulation
What is 16 qam modulationWhat is 16 qam modulation
What is 16 qam modulation
 
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 ...
 
Introduction to wavelet transform
Introduction to wavelet transformIntroduction to wavelet transform
Introduction to wavelet transform
 
Aliasing and Antialiasing filter
Aliasing and Antialiasing filterAliasing and Antialiasing filter
Aliasing and Antialiasing filter
 
Ppt of analog communication
Ppt of analog communicationPpt of analog communication
Ppt of analog communication
 
Hilbert
HilbertHilbert
Hilbert
 
DSP_2018_FOEHU - Lec 04 - The z-Transform
DSP_2018_FOEHU - Lec 04 - The z-TransformDSP_2018_FOEHU - Lec 04 - The z-Transform
DSP_2018_FOEHU - Lec 04 - The z-Transform
 
Equalization
EqualizationEqualization
Equalization
 
Random process and noise
Random process and noiseRandom process and noise
Random process and noise
 

Similar to DIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLAB

DSP Lab 1-6.pdf
DSP Lab 1-6.pdfDSP Lab 1-6.pdf
DSP Lab 1-6.pdf
SaiSumanthK1
 
Dsp Lab Record
Dsp Lab RecordDsp Lab Record
Dsp Lab Record
Aleena Varghese
 
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_L05
Rediet 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).pptx
Nishanth Asmi
 
Pulse Modulation ppt
Pulse Modulation pptPulse Modulation ppt
Pulse Modulation ppt
sanjeev2419
 
Sampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptxSampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptx
HamzaJaved306957
 
Dsp manual
Dsp manualDsp manual
Dsp manual
pramod naik
 
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
Prateek 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 99
Prateek Omer
 
Unit 8
Unit 8Unit 8
Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01
Rimple Mahey
 
Digitla Communication pulse shaping filter
Digitla Communication pulse shaping filterDigitla Communication pulse shaping filter
Digitla Communication pulse shaping filtermirfanjum
 
unit 4,5 (1).docx
unit 4,5 (1).docxunit 4,5 (1).docx
unit 4,5 (1).docx
VIDHARSHANAJ1
 
Module1_dsffffffffffffffffffffgggpa.pptx
Module1_dsffffffffffffffffffffgggpa.pptxModule1_dsffffffffffffffffffffgggpa.pptx
Module1_dsffffffffffffffffffffgggpa.pptx
realme6igamerr
 
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
 
Decimation and Interpolation
Decimation and InterpolationDecimation and Interpolation
Decimation and Interpolation
Fernando Ojeda
 
Dsp gcu lab11
Dsp gcu lab11Dsp gcu lab11
Dsp gcu lab11
Jannat41
 

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Ố
 
Decimation and Interpolation
Decimation and InterpolationDecimation and Interpolation
Decimation and Interpolation
 
Dsp gcu lab11
Dsp gcu lab11Dsp gcu lab11
Dsp gcu lab11
 

More from Martin Wachiye Wafula

Introduction to information theory
Introduction to information theoryIntroduction to information theory
Introduction to information theory
Martin Wachiye Wafula
 
Intelligent reflecting surfaces (IRS)
Intelligent reflecting surfaces  (IRS)Intelligent reflecting surfaces  (IRS)
Intelligent reflecting surfaces (IRS)
Martin Wachiye Wafula
 
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
Martin Wachiye Wafula
 
Disruptive technologies and market place
Disruptive technologies and market placeDisruptive technologies and market place
Disruptive technologies and market place
Martin Wachiye Wafula
 
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
Martin Wachiye Wafula
 
Analog filters matlab_examples
Analog filters matlab_examplesAnalog filters matlab_examples
Analog filters matlab_examples
Martin Wachiye Wafula
 
Matlab task1
Matlab task1Matlab task1
Matlab task1
Martin Wachiye Wafula
 
Matlab problems
Matlab problemsMatlab problems
Matlab problems
Martin Wachiye Wafula
 
Discrete time signals on MATLAB
Discrete time signals on MATLABDiscrete time signals on MATLAB
Discrete time signals on MATLAB
Martin Wachiye Wafula
 
Discrete time signals on MATLAB
Discrete time signals on MATLABDiscrete time signals on MATLAB
Discrete time signals on MATLAB
Martin Wachiye Wafula
 
Unity in diversity
Unity in diversityUnity in diversity
Unity in diversity
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

6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
ssuser7dcef0
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
top1002
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 

Recently uploaded (20)

6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 

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.