summaryrefslogtreecommitdiff
path: root/40/CH7/EX7.9/Exa_7_9.sce
blob: dd88eaf732a97fcb360dd45f97043d415f7efbbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//(a)Quantisation effects
sig=0.005;
D=4;
B=log2(D/(sig*sqrt(12)));//no.of samples
//value of B to ensure quantisation error to 5mv
//(b)Quantisation error and noise
xn=0:0.2:2.0;
xqn=[0 0 0.5 0.5 1 1 1 1.5 1.5 2 2];
en=xn-xqn;//quantization error
//Quantisation signal top noise ratio
x=0;e=0;
for i=1:length(xn)
    x=x+xn(i)^2;
    e=e+en(i)^2;
end
//method 1
SNRQ=10*log10(x/e)
//method 2
SNRQ=10*log10(x/length(xn))+10.8+20*log10(4)-20*log10(2)
SNRS=10*log10(1.33)+10*log10(12)+20*log10(4)-20*log10(2)
//from results we see that SNRS is statistical estimate