em disc ch1 part1
TRANSCRIPT
![Page 1: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/1.jpg)
1
![Page 2: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/2.jpg)
LOGO
LAB 3
Sampling
and
Quantization
![Page 3: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/3.jpg)
3
Sampling Theorem
![Page 4: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/4.jpg)
4
( ) ( )a sx t x nT
![Page 5: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/5.jpg)
5
1( )s
n
X (t) = t nTT
1
( )s
ns
X (f) = f nfT
( )SX (t) = X t X (t)1
( )* ( )s s
n
X (f) = X f X (f) X f nfT
![Page 6: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/6.jpg)
6
1( )
1 1 1 1 1....... ( 2 ) ( ) ( ) ( ) ( 2 ) .......
s s
n
s s s s s
X (f) = X f nfT
X f f X f f X f X f f X f fT T T T T
Sampled Signal
![Page 7: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/7.jpg)
7
![Page 8: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/8.jpg)
8
Ex: x(t)=5 cos (2pi*2000* t)3+ cos (2pi *3000* t)
Fs=8000 Hz
Fs> 2Fm=2*3000=6 kHZ
![Page 9: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/9.jpg)
9
Ex: x(t)=5 cos (2pi*2000* t)3+ cos (2pi *5000* t)
Fs=8000 Hz
Fs< 2Fm=2*5000=10 kHZ
![Page 10: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/10.jpg)
10
k k 1, 2, 3,......S = aliased baseF F F
![Page 11: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/11.jpg)
11
Anti-aliasing Filter
![Page 12: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/12.jpg)
12
Practical Parts
Part 1: Aliasing in Time Domain
a) Let Fs=10 kHz and Fo=1 kHz. Compute and
plot x[n] using stem.
![Page 13: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/13.jpg)
130 10 20 30 40 50 60
-1
-0.5
0
0.5
1
![Page 14: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/14.jpg)
14
b) Use subplot to plot x(t) for Fo=300 Hz and 700 Hz
![Page 15: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/15.jpg)
15
0 1 2 3 4 5
x 10-3
-1
0
1
0 1 2 3 4 5
x 10-3
-1
0
1
![Page 16: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/16.jpg)
16
c) Use subplot to plot x(n) for Fo=300 Hz and 700 Hz
![Page 17: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/17.jpg)
17
0 10 20 30 40 50 60-1
-0.5
0
0.5
1
0 10 20 30 40 50 60-1
-0.5
0
0.5
1
![Page 18: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/18.jpg)
18
d) Use subplot to plot x(t) for Fo=9700 Hz and 9300 Hz
![Page 19: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/19.jpg)
19
0 1 2 3 4 5
x 10-3
-1
0
1
0 1 2 3 4 5
x 10-3
-1
0
1
![Page 20: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/20.jpg)
20
c) Use subplot to plot x(n) for Fo=9700 Hz and 9300 Hz
![Page 21: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/21.jpg)
21
0 10 20 30 40 50 60-1
-0.5
0
0.5
1
0 10 20 30 40 50 60-1
-0.5
0
0.5
1
![Page 22: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/22.jpg)
22
k k 1, 2, 3,......S = aliased baseF F F
300 ( 1) 10000 =9700
700 ( 1) 10000 =9300
300 9700
700 9300
aliased
aliased
F
F
![Page 23: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/23.jpg)
23
![Page 24: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/24.jpg)
24
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2
x 10-3
-1
-0.5
0
0.5
1
gives the same sample every one Ts
![Page 25: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/25.jpg)
25
d) Use subplot to plot x(t) for Fo=10300 Hz and 10700 Hz
![Page 26: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/26.jpg)
26
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
x 10-3
-1
-0.5
0
0.5
1
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
x 10-3
-1
-0.5
0
0.5
1
![Page 27: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/27.jpg)
27
c) Use subplot to plot x(n) for Fo=10300 Hz and 10700 Hz
![Page 28: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/28.jpg)
28
0 10 20 30 40 50 60-1
-0.5
0
0.5
1
0 10 20 30 40 50 60-1
-0.5
0
0.5
1
![Page 29: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/29.jpg)
29
k k 1, 2, 3,......S = aliased baseF F F
300 ( 1) 10000 =10300
700 ( 1) 10000 =10700
300 9700 10300
700 9300 10700
aliased
aliased
F
F
![Page 30: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/30.jpg)
30
Part 2: Aliasing in Frequency Domain
![Page 31: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/31.jpg)
31
![Page 32: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/32.jpg)
32
![Page 33: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/33.jpg)
33
![Page 34: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/34.jpg)
34
Part 3: Quantization
function y=uquant(x,n)
del=((max(max(x))-(min(min(x)))))/(n-1);
r=(x-min(min(x)))/del;
r=round(r);
y=r*del+min(min(x));
![Page 35: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/35.jpg)
35
Example: Quantized x=2sin (2pi*t) using 16 levels.
max min 2 ( 2)4 /15
1 16 1
X Xdel
L
2
2
4
0
![Page 36: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/36.jpg)
36
4
0
![Page 37: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/37.jpg)
37
![Page 38: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/38.jpg)
38
2
2
15
0
![Page 39: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/39.jpg)
39
t=0:.001:1;
y=2*sin(2*pi*t)
figure(1)
subplot(311)
plot(y)
q1=uquant(y,4)
subplot(312)
plot(q1)
q2=uquant(y,32)
subplot(313)
plot(q2)
Ps=mean(y.^2);
Pq1=mean(q1.^2);
Pq2=mean(q2.^2);
SQR1=Ps/Pq1
SQR2=Ps/Pq2
![Page 40: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/40.jpg)
40
0 200 400 600 800 1000 1200-2
0
2
0 200 400 600 800 1000 1200-2
0
2
0 200 400 600 800 1000 1200-2
0
2
![Page 41: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/41.jpg)
41
Image Quantization
Exercise 1
![Page 42: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/42.jpg)
42
clc
clear all
y1=imread('office_4.jpg');
y=rgb2gray(y1);
for i=1:7;
L=2^i;
Q=uquant(y,L);
i=i+1;
pause
L
figure(i)
imshow(Q)
end
![Page 43: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/43.jpg)
43
b=1
![Page 44: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/44.jpg)
44
b=2
![Page 45: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/45.jpg)
45
b=3
![Page 46: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/46.jpg)
46
b=4
![Page 47: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/47.jpg)
47
b=5
![Page 48: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/48.jpg)
48
b=6
![Page 49: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/49.jpg)
49
b=7
![Page 50: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/50.jpg)
50
clc
clear all
[y,fs]=wavread('speech_dft.wav');
sound(y,fs)
for b=1:7;
L=2.^b;
yQ=uquant(y,L);
pause
b
sound(yQ,fs);
end
Audio Quantization
![Page 51: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/51.jpg)
51
Exercise 2
Audio Quantization
![Page 52: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/52.jpg)
52
2 3 4 5 6 7 810
-2
10-1
100
101
102
103
104
plotting SNR
0 1 2 3 4 5 6 7 80
200
400
600
800
1000
1200
1400plotting SNR
![Page 53: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/53.jpg)
53
Simulink model for sampling and quantization
![Page 54: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/54.jpg)
54
Exercise 3
![Page 55: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/55.jpg)
55
Q ua ntization error : ( ) ( ) ( )q qe n x n x n
2 2error
max minQuantization step =1
x x
L
0.1 0.1
2 2error
![Page 56: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/56.jpg)
56
Quantization of sinusoidal signal
2 2
2 2
0 0
2 2
2
2
2
1 1P ( ) ( sin )
2 2
( ) for ( T t T )2
1 1P ( ( )) ( )
2 2
1
2 2
2
2
sig
q
T T
q q
T T
T
T
S t dt A wt dt
e t tT
e t dt t dtT T T
t dtT T
A
Average power of sinusoidal signal :
Average power of quantized signal :
2
12
![Page 57: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/57.jpg)
57
Signal to quantization noise ratio
2
12
2
max min
2
2
2
2
2
the signal to quantization noise ratio
P
P
( ) 2
P 2
P
2
12
4
12
3
2
sig
q
sig
q
SQNR
x x A A A
L L L
A
SQNR
A
LA
L
![Page 58: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/58.jpg)
58
Note:
Your report should include the following:
All Matlab program and its results with a short comment
on each result.
Answer any internal questions in practical parts.
Solve all lab exercises.
![Page 59: EM Disc ch1 part1](https://reader031.vdocuments.us/reader031/viewer/2022012016/615ab898e131eb4ac956dde5/html5/thumbnails/59.jpg)
LOGO
59