SlideShare ist ein Scribd-Unternehmen logo
1 von 12
Downloaden Sie, um offline zu lesen
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.

Weitere ähnliche Inhalte

Was ist angesagt?

DSP_FOEHU - Lec 11 - IIR Filter Design
DSP_FOEHU - Lec 11 - IIR Filter DesignDSP_FOEHU - Lec 11 - IIR Filter Design
DSP_FOEHU - Lec 11 - IIR Filter DesignAmr E. Mohamed
 
DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems
DSP_FOEHU - MATLAB 01 - Discrete Time Signals and SystemsDSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems
DSP_FOEHU - MATLAB 01 - Discrete Time Signals and SystemsAmr E. Mohamed
 
Sampling and Reconstruction of Signal using Aliasing
Sampling and Reconstruction of Signal using AliasingSampling and Reconstruction of Signal using Aliasing
Sampling and Reconstruction of Signal using Aliasingj naga sai
 
D ecimation and interpolation
D ecimation and interpolationD ecimation and interpolation
D ecimation and interpolationSuchi Verma
 
SIGNAL OPERATIONS
SIGNAL OPERATIONSSIGNAL OPERATIONS
SIGNAL OPERATIONSmihir jain
 
Discrete fourier transform
Discrete fourier transformDiscrete fourier transform
Discrete fourier transformMOHAMMAD AKRAM
 
VLSI Design Sequential circuit design
VLSI Design Sequential circuit designVLSI Design Sequential circuit design
VLSI Design Sequential circuit designtamil arasan
 
Pulse Modulation ppt
Pulse Modulation pptPulse Modulation ppt
Pulse Modulation pptsanjeev2419
 
Orthogonal Frequency Division Multiplexing (OFDM)
Orthogonal Frequency Division Multiplexing (OFDM)Orthogonal Frequency Division Multiplexing (OFDM)
Orthogonal Frequency Division Multiplexing (OFDM)Ahmad Gomaa
 
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
 
Dsp 2018 foehu - lec 10 - multi-rate digital signal processing
Dsp 2018 foehu - lec 10 - multi-rate digital signal processingDsp 2018 foehu - lec 10 - multi-rate digital signal processing
Dsp 2018 foehu - lec 10 - multi-rate digital signal processingAmr E. Mohamed
 
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier Transform
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier TransformDSP_2018_FOEHU - Lec 08 - The Discrete Fourier Transform
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier TransformAmr E. Mohamed
 
1.introduction to signals
1.introduction to signals1.introduction to signals
1.introduction to signalsINDIAN NAVY
 
Modulation
ModulationModulation
Modulationsristykp
 
DSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and Systems
DSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and SystemsDSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and Systems
DSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and SystemsAmr E. Mohamed
 

Was ist angesagt? (20)

DSP_FOEHU - Lec 11 - IIR Filter Design
DSP_FOEHU - Lec 11 - IIR Filter DesignDSP_FOEHU - Lec 11 - IIR Filter Design
DSP_FOEHU - Lec 11 - IIR Filter Design
 
DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems
DSP_FOEHU - MATLAB 01 - Discrete Time Signals and SystemsDSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems
DSP_FOEHU - MATLAB 01 - Discrete Time Signals and Systems
 
Convolution
ConvolutionConvolution
Convolution
 
Sampling and Reconstruction of Signal using Aliasing
Sampling and Reconstruction of Signal using AliasingSampling and Reconstruction of Signal using Aliasing
Sampling and Reconstruction of Signal using Aliasing
 
D ecimation and interpolation
D ecimation and interpolationD ecimation and interpolation
D ecimation and interpolation
 
SIGNAL OPERATIONS
SIGNAL OPERATIONSSIGNAL OPERATIONS
SIGNAL OPERATIONS
 
Discrete fourier transform
Discrete fourier transformDiscrete fourier transform
Discrete fourier transform
 
VLSI Design Sequential circuit design
VLSI Design Sequential circuit designVLSI Design Sequential circuit design
VLSI Design Sequential circuit design
 
Pulse Modulation ppt
Pulse Modulation pptPulse Modulation ppt
Pulse Modulation ppt
 
Orthogonal Frequency Division Multiplexing (OFDM)
Orthogonal Frequency Division Multiplexing (OFDM)Orthogonal Frequency Division Multiplexing (OFDM)
Orthogonal Frequency Division Multiplexing (OFDM)
 
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
 
Dsp 2018 foehu - lec 10 - multi-rate digital signal processing
Dsp 2018 foehu - lec 10 - multi-rate digital signal processingDsp 2018 foehu - lec 10 - multi-rate digital signal processing
Dsp 2018 foehu - lec 10 - multi-rate digital signal processing
 
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier Transform
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier TransformDSP_2018_FOEHU - Lec 08 - The Discrete Fourier Transform
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier Transform
 
1.introduction to signals
1.introduction to signals1.introduction to signals
1.introduction to signals
 
Fir filter_utkarsh_kulshrestha
Fir filter_utkarsh_kulshresthaFir filter_utkarsh_kulshrestha
Fir filter_utkarsh_kulshrestha
 
Modulation
ModulationModulation
Modulation
 
DSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and Systems
DSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and SystemsDSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and Systems
DSP_2018_FOEHU - Lec 03 - Discrete-Time Signals and Systems
 
Signals & systems
Signals & systems Signals & systems
Signals & systems
 
Matched filter
Matched filterMatched filter
Matched filter
 
Z transform ROC eng.Math
Z transform ROC eng.MathZ transform ROC eng.Math
Z transform ROC eng.Math
 

Ähnlich wie DIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLAB

Matlab 2
Matlab 2Matlab 2
Matlab 2asguna
 
signal homework
signal homeworksignal homework
signal homeworksokok22867
 
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
 
Sampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptxSampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptxHamzaJaved306957
 
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 SignalsAmr E. Mohamed
 
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
 
Decimation and Interpolation
Decimation and InterpolationDecimation and Interpolation
Decimation and InterpolationFernando Ojeda
 
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
 

Ähnlich wie 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
 
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
 
Sampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptxSampling and Reconstruction (Online Learning).pptx
Sampling and Reconstruction (Online Learning).pptx
 
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
 
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
 
On The Fundamental Aspects of Demodulation
On The Fundamental Aspects of DemodulationOn The Fundamental Aspects of Demodulation
On The Fundamental Aspects of Demodulation
 

Mehr von Martin Wachiye Wafula

Mehr von 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
 

Kürzlich hochgeladen

Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 

Kürzlich hochgeladen (20)

Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 

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.