summaryrefslogtreecommitdiff
path: root/758/CH11
diff options
context:
space:
mode:
Diffstat (limited to '758/CH11')
-rwxr-xr-x758/CH11/EX11.1/Ex_11_1.sce11
-rwxr-xr-x758/CH11/EX11.2/Ex_11_2.sce14
-rwxr-xr-x758/CH11/EX11.4/Ex_11_4.sce23
-rwxr-xr-x758/CH11/EX11.5/Ex_11_5.sce46
-rwxr-xr-x758/CH11/EX11.6/Ex_11_6.sce47
5 files changed, 141 insertions, 0 deletions
diff --git a/758/CH11/EX11.1/Ex_11_1.sce b/758/CH11/EX11.1/Ex_11_1.sce
new file mode 100755
index 000000000..3d96d6869
--- /dev/null
+++ b/758/CH11/EX11.1/Ex_11_1.sce
@@ -0,0 +1,11 @@
+//Example 11.1
+
+clc;clear;close;
+x=[0:6 0:6];
+y=x(1:3:length(x));
+disp(x,'Input signal x(n)=');
+disp(y,'Output signal of decimation process by factor three y(n)');
+subplot(2,1,1);
+plot2d3(x);title('Input signal x(n)');
+subplot(2,1,2);
+plot2d3(y);title('Output signal y(n)');
diff --git a/758/CH11/EX11.2/Ex_11_2.sce b/758/CH11/EX11.2/Ex_11_2.sce
new file mode 100755
index 000000000..9face8e3a
--- /dev/null
+++ b/758/CH11/EX11.2/Ex_11_2.sce
@@ -0,0 +1,14 @@
+//Example 11.2
+
+clc;clear;close;
+x=0:5;
+y=[];
+for i=1:length(x)
+ y(1,2*i)=x(i);
+end
+disp(x,'Input signal x(n)=');
+disp(y,'Output signal of interpolation process with factor two y(n)');
+subplot(2,1,1);
+plot2d3(x);title('Input signal x(n)');
+subplot(2,1,2);
+plot2d3(y);title('Output signal y(n)');
diff --git a/758/CH11/EX11.4/Ex_11_4.sce b/758/CH11/EX11.4/Ex_11_4.sce
new file mode 100755
index 000000000..6e0cf0690
--- /dev/null
+++ b/758/CH11/EX11.4/Ex_11_4.sce
@@ -0,0 +1,23 @@
+//Example 11.4
+
+clc;clear;
+z=poly(0,'z');
+num=1-4*z^-1;
+den=1+5*z^-1;
+H=num/den;
+num1=num*(1-5*z^-1);
+den1=den*(1-5*z^-1);
+H1=num1/den1;
+c=coeff(numer(num1));
+clength=length(c);
+c=[c zeros(1,pmodulo(clength,2))]; //make length of 'c' multiple of 2
+c0=[];c1=[];
+for n=1:ceil(clength/2) //loop to separate even and odd powers of z
+ c0=[c0 c(2*n-1) 0];
+ c1=[c1 c(2*n) 0];
+end
+E0=poly(c0,'z','coeff')/z^n/den1;
+E1=poly(c1,'z','coeff')/z^(n-2)/den1;
+disp('Polyphase Components')
+disp(E0,'E0(z)');
+disp(E1,'E1(z)'); \ No newline at end of file
diff --git a/758/CH11/EX11.5/Ex_11_5.sce b/758/CH11/EX11.5/Ex_11_5.sce
new file mode 100755
index 000000000..7de093d1b
--- /dev/null
+++ b/758/CH11/EX11.5/Ex_11_5.sce
@@ -0,0 +1,46 @@
+//Example 11.5
+
+clc;clear;
+
+function [N,R]=func(Fs,Fp,Ft,Fti,dp,ds,M)
+ dF=(Fs-Fp)/Ft; //Normalised transition bandwidth
+ N=round((-20*log10(sqroot(dp*ds))-13)/(14.6*dF)); //FIR Filter length
+ R=N*Fti/M; //Number of Multiplications per second
+endfunction
+
+Ft=20000; //Sampling rate of input signal
+Fp=40; //Passband frequency
+Fs=50; //Stopband frequency
+dp=0.01; //Passband ripple
+ds=0.002; //Stopband ripple
+M=100; //Decimation Factor
+Fti=Ft; //Input sampling rate
+//Single stage implementation
+[N1,R1]=func(Fs,Fp,Ft,Fti,dp,ds,M);
+
+//Two stage implementation
+//Stage 1 F(z) with decimation factor 50
+Fpf=Fp; //Passband frequency
+Fsf=190; //Stopband frequency
+dpf=0.005; //Passband ripple
+dsf=0.002; //Stopband ripple
+Mf=50; //Decimation Factor
+Fti=Ft; //Input sampling rate
+[N2f,R2f]=func(Fsf,Fpf,Ft,Fti,dpf,dsf,Mf);
+
+//Stage 2 G(z) with decimation factor 2
+Fpg=50*Fp; //Passband frequency
+Fsg=50*Fs; //Stopband frequency
+dpg=0.005; //Passband ripple
+dsg=0.002; //Stopband ripple
+Mg=2; //Decimation Factor
+Fti=Ft/50; //Input sampling rate
+[N2g,R2g]=func(Fsg,Fpg,Ft,Fti,dpg,dsg,Mg);
+N2=N2f+50*N2g+2; //Total filter length
+R2=R2f+R2g; //Total Number of Multiplications per second
+disp(R1,'Number of Multiplications per second =',N1,'FIR filter length =','For Single stage implementation:');
+disp('For Two stage implementation:');
+disp(R2f,'Number of Multiplications per second =',N2f,'FIR filter length =','For F(z):');
+disp(R2g,'Number of Multiplications per second =',N2g,'FIR filter length =','For G(z):');
+disp(R2,'Total Number of Multiplications per second =',N2,'Overall FIR filter length =');
+
diff --git a/758/CH11/EX11.6/Ex_11_6.sce b/758/CH11/EX11.6/Ex_11_6.sce
new file mode 100755
index 000000000..3438bdbfb
--- /dev/null
+++ b/758/CH11/EX11.6/Ex_11_6.sce
@@ -0,0 +1,47 @@
+//Example 11.6
+
+clc;clear;
+
+
+function [N,R]=func(Fs,Fp,Ft,Fti,dp,ds,M)
+ dF=(Fs-Fp)/Ft; //Normalised transition bandwidth
+ N=round((-20*log10(sqroot(dp*ds))-13)/(14.6*dF)); //FIR Filter length
+ R=N*Fti/M; //Number of Multiplications per second
+endfunction
+
+Ft=10000; //Sampling rate of input signal
+Fp=150; //Passband frequency
+Fs=180; //Stopband frequency
+dp=0.002; //Passband ripple
+ds=0.001; //Stopband ripple
+M=20; //Decimation Factor
+Fti=Ft; //Input sampling rate
+//Single stage implementation
+[N1,R1]=func(Fs,Fp,Ft,Fti,dp,ds,M);
+
+//Two stage implementation
+//Stage 1 F(z) with decimation factor 50
+Fpf=Fp; //Passband frequency
+Fsf=720; //Stopband frequency
+dpf=0.001; //Passband ripple
+dsf=0.001; //Stopband ripple
+Mf=10; //Decimation Factor
+Fti=Ft; //Input sampling rate
+[N2f,R2f]=func(Fsf,Fpf,Ft,Fti,dpf,dsf,Mf);
+
+//Stage 2 G(z) with decimation factor 2
+Fpg=10*Fp; //Passband frequency
+Fsg=10*Fs; //Stopband frequency
+dpg=0.001; //Passband ripple
+dsg=0.001; //Stopband ripple
+Mg=2; //Decimation Factor
+Fti=Ft/10; //Input sampling rate
+[N2g,R2g]=func(Fsg,Fpg,Ft,Fti,dpg,dsg,Mg);
+N2=N2f+10*N2g+2; //Total filter length
+R2=R2f+R2g; //Total Number of Multiplications per second
+
+disp(R1,'Number of Multiplications per second =',N1,'FIR filter length =','For Single stage implementation:');
+disp('For Two stage implementation:');
+disp(R2f,'Number of Multiplications per second =',N2f,'FIR filter length =','For F(z):');
+disp(R2g,'Number of Multiplications per second =',N2g,'FIR filter length =','For G(z):');
+disp(R2,'Total Number of Multiplications per second =',N2,'Overall FIR filter length ='); \ No newline at end of file