summaryrefslogtreecommitdiff
path: root/830/CH10
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /830/CH10
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '830/CH10')
-rwxr-xr-x830/CH10/EX10.5.1/FIR_DECIMATION_2.sce40
-rwxr-xr-x830/CH10/EX10.5.2/FIR_INTERPOLATION_5.sce40
-rwxr-xr-x830/CH10/EX10.6.1/Sampling_Rate_Conversion_Decimation.sce48
-rwxr-xr-x830/CH10/EX10.8.1/Signal_Distortion_Ratio.sce13
-rwxr-xr-x830/CH10/EX10.8.2/Signal_Distortion_Ratio_Linear_Interpolation.sce13
-rwxr-xr-x830/CH10/EX10.9.1/Sampling_Rate_Conversion_Decimation_Interpolation.sce42
6 files changed, 196 insertions, 0 deletions
diff --git a/830/CH10/EX10.5.1/FIR_DECIMATION_2.sce b/830/CH10/EX10.5.1/FIR_DECIMATION_2.sce
new file mode 100755
index 000000000..3d74a3a92
--- /dev/null
+++ b/830/CH10/EX10.5.1/FIR_DECIMATION_2.sce
@@ -0,0 +1,40 @@
+//Graphical//
+//Example 10.5.1
+//Decimation by 2, Filter Length = 30
+//Cutoff Frequency Wc = %pi/2
+//Pass band Edge frequency fp = 0.25 and a Stop band edge frequency fs = 0.31
+// Choose the number of cosine functions and create a dense grid
+// in [0,0.25] and [0.31,0.5]
+//magnitude for pass band = 1 & stop band = 0 (i.e) [1 0]
+//Weighting function =[2 1]
+clear;
+clc;
+close;
+M = 30; //Filter Length
+D = 2; //Decimation Factor = 2
+Wc = %pi/2; //Cutoff Frequency
+Wp = Wc/(2*%pi); //Passband Edge Frequency
+Ws = 0.31; //Stopband Edge Frequency
+hn=eqfir(M,[0 Wp;Ws .5],[1 0],[2 1]);
+[hm,fr]=frmag(hn,256);
+disp('The LPF Filter Coefficients are:')
+hn
+//Obtaining Polyphase Filter Coefficients from hn
+p = zeros(D,M/D);
+for k = 1:D
+ for n = 1:(length(hn)/D)
+ p(k,n) = hn(D*(n-1)+k);
+ end
+end
+disp('The Polyphase Decimator for D =2 are:')
+p
+figure
+plot(fr,hm)
+xlabel('Normalized Digital Frequency fr');
+ylabel('Magnitude');
+title('Frequency Response of FIR LPF using REMEZ algorithm M=61')
+figure
+plot(.5*(0:255)/256,20*log10(frmag(hn,256)));
+xlabel('Normalized Digital Frequency fr');
+ylabel('Magnitude in dB');
+title('Frequency Response of DECIMATOR (D=2) using REMEZ algorithm M=30')
diff --git a/830/CH10/EX10.5.2/FIR_INTERPOLATION_5.sce b/830/CH10/EX10.5.2/FIR_INTERPOLATION_5.sce
new file mode 100755
index 000000000..1720e5155
--- /dev/null
+++ b/830/CH10/EX10.5.2/FIR_INTERPOLATION_5.sce
@@ -0,0 +1,40 @@
+//Graphical//
+//Example 10.5.2
+//Interpolation by 5, Filter Length = 30
+//Cutoff Frequency Wc = %pi/5
+//Pass band Edge frequency fp = 0.1 and a Stop band edge frequency fs = 0.16
+// Choose the number of cosine functions and create a dense grid
+// in [0,0.1) and [0.16,0.5)
+//magnitude for pass band = 1 & stop band = 0 (i.e) [1 0]
+//Weighting function =[3 1]
+clear;
+clc;
+close;
+M = 30; //Filter Length
+I = 5; //Interpolation Factor = 5
+Wc = %pi/5; //Cutoff Frequency
+Wp = Wc/(2*%pi); //Passband Edge Frequency
+Ws = 0.16; //Stopband Edge Frequency
+hn=eqfir(M,[0 Wp;Ws .5],[1 0],[3 1]);
+[hm,fr]=frmag(hn,256);
+disp('The LPF Filter Coefficients are:')
+hn
+//Obtaining Polyphase Filter Coefficients from hn
+p = zeros(I,M/I);
+for k = 1:I
+ for n = 1:(length(hn)/I)
+ p(k,n) = hn(I*(n-1)+k);
+ end
+end
+disp('The Polyphase Interpolator for I =5 are:')
+p
+figure
+plot(fr,hm)
+xlabel('Normalized Digital Frequency fr');
+ylabel('Magnitude');
+title('Frequency Response of FIR LPF using REMEZ algorithm M=61')
+figure
+plot(.5*(0:255)/256,20*log10(frmag(hn,256)));
+xlabel('Normalized Digital Frequency fr');
+ylabel('Magnitude in dB');
+title('Frequency Response of INTERPOLATOR(I=5) using REMEZ algorithm M=30')
diff --git a/830/CH10/EX10.6.1/Sampling_Rate_Conversion_Decimation.sce b/830/CH10/EX10.6.1/Sampling_Rate_Conversion_Decimation.sce
new file mode 100755
index 000000000..6ee05b0f2
--- /dev/null
+++ b/830/CH10/EX10.6.1/Sampling_Rate_Conversion_Decimation.sce
@@ -0,0 +1,48 @@
+//Graphical//
+//Example 10.6.1
+//Multistage Implementation of Sampling Rate Conversion
+//Decimation factor D = 50
+//D = D1xD2, D1 = 25, D2 =2
+clear;
+clc;
+close;
+Fs = 8000; //Sampling Frequency = 8000Hz
+Fpc = 75; //Passband Frequency
+Fsc = 80; //Stopband Frequency
+Delta_F = (Fsc-Fpc)/Fs; //Transition Band
+Pass_Band = [0,Fpc];
+Transition_Band = [Fpc,Fsc];
+Delta1 = (10^-2); //Passband Ripple
+Delta2 = (10^-4); //Stopband Ripple
+D = Fs/(2*Fsc); //Decimation Factor
+//Decimator Implemented in Two Stages
+D1 = D/2; //Decimator 1
+D2 = 2; //Decimator 2
+//Decimator Single Stage Implementation
+M = ((-10*log10(Delta1*Delta2)-13)/(14.6*Delta_F))+1;
+M = ceil(M)
+//Decimator Multistage Implementation
+//First Stage Implementation
+F1 = Fs/D1; //New passband for stage1
+Fsc1 = F1-Fsc; //New Stopband for stage1
+Delta_F1 = (Fsc1-Fpc)/Fs //New Transition for stage1
+Delta11 = Delta1/2; //New Passband Ripple
+Delta21 = Delta2; //Stopband Ripple same
+M1 = ((-10*log10(Delta11*Delta21)-13)/(14.6*Delta_F1))+1
+M1 = floor(M1)
+//Second Stage Implementation
+F2 = F1/D2; //New passband for stage2
+Fsc2 = F2-Fsc; //New Stopband for stage2
+Delta_F2 = (Fsc2-Fpc)/F1 //New Transition for stage2
+Delta12 = Delta1/2; //New Passband Ripple
+Delta22 = Delta2; //Stopband Ripple same
+M2 = ((-10*log10(Delta12*Delta22)-13)/(14.6*Delta_F2))+1
+M2 = floor(M2)
+disp('The Filter length Required in Single stage Implementation of Decimator is:')
+M
+disp('The Filter length Required in Multistage Implementation of Decimator is:')
+M1+M2
+//Calculation of Reduction Factor
+R = M/(M1+M2);
+disp('The Reduction in Filter Length is:')
+R
diff --git a/830/CH10/EX10.8.1/Signal_Distortion_Ratio.sce b/830/CH10/EX10.8.1/Signal_Distortion_Ratio.sce
new file mode 100755
index 000000000..58888f4f6
--- /dev/null
+++ b/830/CH10/EX10.8.1/Signal_Distortion_Ratio.sce
@@ -0,0 +1,13 @@
+//Graphical//
+//Example 10.8.1
+//Signal to Distortion Ratio
+//Calculation of no. of subfilters
+clear;
+clc;
+close;
+SDR_dB = 50; //Signal to distortion ratio = 50 dB
+Wx = 0.8*%pi; //Digital maximum frequency of input data
+SDR = 10^(SDR_dB/10)
+disp('The Number of subfilters required')
+I = Wx*sqrt(SDR/12);
+I = ceil(I)
diff --git a/830/CH10/EX10.8.2/Signal_Distortion_Ratio_Linear_Interpolation.sce b/830/CH10/EX10.8.2/Signal_Distortion_Ratio_Linear_Interpolation.sce
new file mode 100755
index 000000000..7ec3f6856
--- /dev/null
+++ b/830/CH10/EX10.8.2/Signal_Distortion_Ratio_Linear_Interpolation.sce
@@ -0,0 +1,13 @@
+//Graphical//
+//Example 10.8.2
+//Signal to Distortion Ratio using Linear Interpolation
+//Calculation of no. of subfilters
+clear;
+clc;
+close;
+SDR_dB = 50; //Signal to distortion ratio = 50 dB
+Wx = 0.8*%pi; //Digital maximum frequency of input data
+SDR = 10^(SDR_dB/10)
+disp('The Number of subfilters required')
+I = Wx*((SDR/80)^(1/4));
+I = ceil(I)
diff --git a/830/CH10/EX10.9.1/Sampling_Rate_Conversion_Decimation_Interpolation.sce b/830/CH10/EX10.9.1/Sampling_Rate_Conversion_Decimation_Interpolation.sce
new file mode 100755
index 000000000..13b45645e
--- /dev/null
+++ b/830/CH10/EX10.9.1/Sampling_Rate_Conversion_Decimation_Interpolation.sce
@@ -0,0 +1,42 @@
+//Graphical//
+//Example 10.9.1
+//Multistage Implementation of Sampling Rate Conversion
+//Decimation factor D = 100
+//D = D1xD2, D1 = 50, D2 =2
+//Interpolation factor I = 100
+//I = I1xI2, I1 = 2, I2 =50
+clear;
+clc;
+close;
+Fs = 8000; //Sampling Frequency = 8000Hz
+Fpc = 75; //Passband Frequency
+Fsc = 80; //Stopband Frequency
+Delta_F = (Fsc-Fpc)/Fs; //Transition Band
+Pass_Band = [0,Fpc];
+Transition_Band = [Fpc,Fsc];
+Delta1 = (10^-2); //Passband Ripple
+Delta2 = (10^-4); //Stopband Ripple
+D = Fs/(2*Fsc); //Decimation Factor
+//Decimator Implemented in Two Stages
+D1 = D/2; //Decimator 1
+D2 = 2; //Decimator 2
+//Decimator Single Stage Implementation
+M = ((-10*log10(Delta1*Delta2/2)-13)/(14.6*Delta_F))+1;
+M = ceil(M)
+//Decimator Multistage Implementation
+//First Stage Implementation
+Delta_F1 = 0.020625 //Obtained from Example 10.6.1
+M1 = ((-10*log10(Delta1*Delta2/4)-13)/(14.6*Delta_F1))+1
+M1 = floor(M1)
+//Second Stage Implementation
+Delta_F2 = 0.015625 //Obtained from Example 10.6.1
+M2 = ((-10*log10(Delta1*Delta2/4)-13)/(14.6*Delta_F2))+1
+M2 = floor(M2)
+disp('The Filter length Required in Single stage Implementation of Decimator is:')
+M
+disp('The Filter length Required in Multistage Implementation of Decimator is:')
+M1+M2
+//Calculation of Reduction Factor
+R = M/(M1+M2);
+disp('The Reduction in Filter Length is:')
+R