summaryrefslogtreecommitdiff
path: root/2303/CH10/EX10.5/10_5.sce
blob: 4a4cb41da3e3cc0f873fe1d3bc9ce600ab42ec6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//Example 10.5

clc;
clear;
close;

fs1=64000;                  //original signal sampling frequency
fs2=2048000;                //new sampling frequency
df=32;                    //decimation factor of filter
fp=30000;                   //pass band edge frequency
fs=32000;                   //stop band edge freqeucny
tw=2000;                    //transition width
pbdev=0.01;              //pass band deviation in decibel
sbatt=80;               //stop band attenuation in decibe

//Calculating delta-f
df=tw/fs2;
//Ca;culating passband and stop band deviations
dp=10^(pbdev/20)-1;
ds=10^-(sbatt/20);

//filter coefficients required for order of filter
a1=0.005309;
a2=0.07114;
a3=-0.4761;
a4=-0.00266;
a5=-0.5941;
a6=-0.4278;

D={log10(ds)*[a1*log10(dp^2)+a2*[log10(dp)]+a3]}+[a4*log10(dp^2)+a5*[log10(dp)]+a6];
f=11.01217+0.51244*(log10(dp)-log10(ds));
N=ceil(D/df-f+1);
disp(N,"Order of filter is ");

disp(N*fs2,"Number of multiplications required is: ")