diff options
author | prashantsinalkar | 2017-10-10 12:38:01 +0530 |
---|---|---|
committer | prashantsinalkar | 2017-10-10 12:38:01 +0530 |
commit | f35ea80659b6a49d1bb2ce1d7d002583f3f40947 (patch) | |
tree | eb72842d800ac1233e9d890e020eac5fd41b0b1b /40/CH10/EX10.5b/Exa_10_5b.sce | |
parent | 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (diff) | |
download | Scilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.tar.gz Scilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.tar.bz2 Scilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.zip |
updated the code
Diffstat (limited to '40/CH10/EX10.5b/Exa_10_5b.sce')
-rwxr-xr-x | 40/CH10/EX10.5b/Exa_10_5b.sce | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/40/CH10/EX10.5b/Exa_10_5b.sce b/40/CH10/EX10.5b/Exa_10_5b.sce index 7a3f04ee9..b98473816 100755 --- a/40/CH10/EX10.5b/Exa_10_5b.sce +++ b/40/CH10/EX10.5b/Exa_10_5b.sce @@ -1,32 +1,32 @@ -//Fir high pass filter design by frequency sampling
-z=%z;
-N=10;
-magHk=[0 0 0 1 1 1 1 1 0 0];
-k=[0:5 -4:-1:-1];
-fik=(-%pi*k'*(N-1)/N)+(0.5*%pi);
-for i=1:length(fik)
- H1k(i)=magHk(i)*exp(%i*fik(i));
-end
-H1n=(dft(H1k,1));
-H2k=H1k;
-H2k(3)=0.5*%e^(-%i*1.3*%pi);
-H2k(9)=0.5*%e^(%i*1.3*%pi);
-H2n=(dft(H2k,1));
-H1Z=0;H2Z=0;
-for i=1:length(H1n)
- H1Z=H1Z+H1n(i)*z^(-i);
-end
-for i=1:length(H2n)
- H2Z=H2Z+H2n(i)*z^(-i);
-end
-F=0:0.01:1;
-F1=0:0.1:0.9;
-H1F=abs(horner(H1Z,exp(%i*2*%pi*F')));
-H2F=abs(horner(H2Z,exp(%i*2*%pi*F')));
-a=gca();
-plot2d(F1,magHk);
-plot2d(F,H2F);
-plot2d(F,H1F);
-xlabel('Digital Frequency F');
-ylabel('magnitude');
+//For high pass filter design by frequency sampling +z=%z; +N=10; +magHk=[0 0 0 1 1 1 1 1 0 0]; +k=[0:5 -4:-1:-1]; +fik=(-%pi*k'*(N-1)/N)+(0.5*%pi); +for i=1:length(fik) + H1k(i)=magHk(i)*exp(%i*fik(i)); +end +H1n=(fft(H1k,1)); +H2k=H1k; +H2k(3)=0.5*%e^(-%i*1.3*%pi); +H2k(9)=0.5*%e^(%i*1.3*%pi); +H2n=(fft(H2k,1)); +H1Z=0;H2Z=0; +for i=1:length(H1n) + H1Z=H1Z+H1n(i)*z^(-i); +end +for i=1:length(H2n) + H2Z=H2Z+H2n(i)*z^(-i); +end +F=0:0.01:1; +F1=0:0.1:0.9; +H1F=abs(horner(H1Z,exp(%i*2*%pi*F'))); +H2F=abs(horner(H2Z,exp(%i*2*%pi*F'))); +a=gca(); +plot2d(F1,magHk); +plot2d(F,H2F); +plot2d(F,H1F); +xlabel('Digital Frequency F'); +ylabel('magnitude'); xtitle('Low pass filter using frequency sampling');
\ No newline at end of file |