diff options
Diffstat (limited to '758/CH7')
-rwxr-xr-x | 758/CH7/EX7.3/Ex_7_3.sce | 21 | ||||
-rwxr-xr-x | 758/CH7/EX7.4/Ex_7_4.sce | 19 |
2 files changed, 40 insertions, 0 deletions
diff --git a/758/CH7/EX7.3/Ex_7_3.sce b/758/CH7/EX7.3/Ex_7_3.sce new file mode 100755 index 000000000..482166b37 --- /dev/null +++ b/758/CH7/EX7.3/Ex_7_3.sce @@ -0,0 +1,21 @@ +//Example 7.3
+
+clc;clear;close;
+fp=2000; //passband frequency
+F=9600; //sampling frequancy
+
+//Calculation of filter co-efficients
+a0=1/F*integrate('1','t',-fp,fp);
+for n=1:10;
+a(1,n)=2/F*integrate('cos(2*%pi*n*f/F)','f',-fp,fp);
+end
+h=[a(:,$:-1:1)/2 a0 a/2];
+
+//Displaying filter co-efficients
+disp(F,'Sampling frequency F= ',fp,'Assumption: Passband frequency fp= ');
+disp('Filter co-efficients:');
+disp(a0,'h(0)= ');disp(a/2,'h(n)=h(-n)=');
+
+n=-10:10;
+plot2d3(n,h);
+title('Filter transfer function h(n)');xlabel('n-->');
\ No newline at end of file diff --git a/758/CH7/EX7.4/Ex_7_4.sce b/758/CH7/EX7.4/Ex_7_4.sce new file mode 100755 index 000000000..15ef34ce7 --- /dev/null +++ b/758/CH7/EX7.4/Ex_7_4.sce @@ -0,0 +1,19 @@ +//Example 7.4
+
+clc;clear;close;
+M=7;w=2*%pi/M;
+
+//Calculation of filter co-efficients
+k=[0 1 6];
+for n=0:M-1
+ h(n+1)=sum(exp(-%i*3*w*k).*exp(%i*w*k*n))/M;
+end
+h=clean(h);
+
+//Displaying filter co-efficients
+disp(M,'Filter Order M= ');
+disp('Filter co-efficients:');
+disp(h,'h(n)= ');
+
+plot2d3(h);
+title('Filter transfer function h(n)');xlabel('n-->');
\ No newline at end of file |