diff options
Diffstat (limited to '692/CH4')
-rwxr-xr-x | 692/CH4/EX4.16/P4_16.sce | 30 | ||||
-rwxr-xr-x | 692/CH4/EX4.5/P4_5.sce | 10 | ||||
-rwxr-xr-x | 692/CH4/EX4.6/P4_6.sce | 19 | ||||
-rwxr-xr-x | 692/CH4/EX4.7/P4_7.sce | 20 | ||||
-rwxr-xr-x | 692/CH4/EX4.8/P4_8.sce | 27 |
5 files changed, 106 insertions, 0 deletions
diff --git a/692/CH4/EX4.16/P4_16.sce b/692/CH4/EX4.16/P4_16.sce new file mode 100755 index 000000000..f199c6d3f --- /dev/null +++ b/692/CH4/EX4.16/P4_16.sce @@ -0,0 +1,30 @@ +//EXAMPLE 4.16 +//Design analog butterworth High pass filter +clc; +clear; +wp=4000; +ws=1000; +ap=0.1; +as=40; + +Ap=1; // assumption +As=(2*%pi*wp)*Ap/(2*%pi*ws); + +N=ceil(log10(sqrt((10^(0.1* as)-1)/(10^(0.1*ap)-1)))/log10(As/Ap)); +disp(N,'order of the filter is :'); + +Ac = As/((10^(0.1*as)-1)^(1/(N*2))); +disp(Ac,'cutoff frequency = ') + +//[hs,pole,zero,gain]=analpf(N,'butt',Ac); + +s=%s; +hs=1/((s + 1)*(s^2 + 0.61803*s + 1)*(s^2 + 1.61803*s + 1)); +Hs=horner(hs,s/Ac); +H1 = numer(Hs)/0.0976514; +H2 = denom(Hs)/0.0976514; +disp(H1/H2,'the low pass transfer function is,HLP(s) = '); +Hs=horner(hs,Ac/s); +H1 = numer(Hs); +H2 = denom(Hs); +disp(H1/H2,'the High pass transfer function is,HHP(s) = '); diff --git a/692/CH4/EX4.5/P4_5.sce b/692/CH4/EX4.5/P4_5.sce new file mode 100755 index 000000000..335889981 --- /dev/null +++ b/692/CH4/EX4.5/P4_5.sce @@ -0,0 +1,10 @@ +//EXAMPLE 4.5 +//determine ripple values in db; +clc +clear; +ap = 0.01//Peak passband ripple in dB +as = 70//min. stopband atteuation in dB +dp = 1-10^-(ap/20); +ds = 10^-(as/20); +disp( dp,'dp = '); +disp( ds,'ds = ');
\ No newline at end of file diff --git a/692/CH4/EX4.6/P4_6.sce b/692/CH4/EX4.6/P4_6.sce new file mode 100755 index 000000000..78f52ddf7 --- /dev/null +++ b/692/CH4/EX4.6/P4_6.sce @@ -0,0 +1,19 @@ +//EXAMPLE 4.6 +//Order of LP filter +clc; +clear; +ap = 1 //Peak passband ripple in dB +as = 40 //min. stopband atteuation in dB +wp = 1000 //Hz +ws = 5000 //Hz +k = wp/ws; +disp(1/k,'1/k = '); +k1 = 1/(sqrt((10^(0.1* as)-1)/(10^(0.1*ap)-1))); +disp(1/k1,'1/k1 = '); +N=ceil(log10(sqrt((10^(0.1* as)-1)/(10^(0.1*ap)-1)))/log10(1/k)); +disp(N,'order of the filter is :'); + + + + + diff --git a/692/CH4/EX4.7/P4_7.sce b/692/CH4/EX4.7/P4_7.sce new file mode 100755 index 000000000..506b25ff5 --- /dev/null +++ b/692/CH4/EX4.7/P4_7.sce @@ -0,0 +1,20 @@ +//EXAMPLE 4.7 +//Determine the order of Analog Chebyshev LP filter. +clc; +clear; +ap = 1 //dB +as = 40 //dB +wp = 1000 //Hz +ws = 5000 //Hz +k = wp/ws; +disp(1/k,'1/k = '); +k1 = 1/(sqrt(((10^(0.1* as))-1)/((10^(0.1*ap))-1))); +disp(1/k1,'1/k1 = '); +N = acosh(1/k1)/acosh(1/k); +disp(N,'N = '); +disp('Since order of the filter is always an integer, '); +disp(ceil(N),'Order of the filter is, N = '); + + + + diff --git a/692/CH4/EX4.8/P4_8.sce b/692/CH4/EX4.8/P4_8.sce new file mode 100755 index 000000000..11adcf481 --- /dev/null +++ b/692/CH4/EX4.8/P4_8.sce @@ -0,0 +1,27 @@ +//EXAMPLE 4.8 +//Determine the order of Analog Elliptic LP filter. +clc; +clear; +ap = 1 //dB +as = 40 //dB +Fp = 1000 //Hz +Fs = 5000 //Hz +wp = Fp*2*%pi; +ws = Fs*2*%pi; + + +k1 = 1/(sqrt((10^(0.1* as)-1)/(10^(0.1*ap)-1))); +disp(1/k1,'1/k1 = '); +k = wp/ws; +k2 = sqrt(1 - (k*k)); +disp(k2,"k2 = "); +po = (1 - sqrt(k2))/(2*(1 + sqrt(k2))); +disp(po,'po = '); +p = po +2*po^5 + 15*po^9 + 150*po^13; +disp(p,'p = '); +N = (2*log10(4/k1))/log10(1/p); +disp(N,'N = '); +disp('Since order of the filter is always an integer, '); +disp(ceil(N),'Order of the filter is, N = '); + + |