summaryrefslogtreecommitdiff
path: root/830/CH5/EX5.3.1
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /830/CH5/EX5.3.1
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/CH5/EX5.3.1')
-rwxr-xr-x830/CH5/EX5.3.1/Linear_Filtering_DFT.sce39
1 files changed, 39 insertions, 0 deletions
diff --git a/830/CH5/EX5.3.1/Linear_Filtering_DFT.sce b/830/CH5/EX5.3.1/Linear_Filtering_DFT.sce
new file mode 100755
index 000000000..572be43de
--- /dev/null
+++ b/830/CH5/EX5.3.1/Linear_Filtering_DFT.sce
@@ -0,0 +1,39 @@
+//Graphical//
+//Example 5.3.1
+//Performing Linear Filtering (i.e) Linear Convolution
+//Using DFT
+clear;
+clc;
+close;
+h = [1,2,3]; //Impulse Response of LTI System
+x = [1,2,2,1]; //Input Response of LTI System
+N1 = length(x)
+N2 = length(h)
+disp('Length of Output Response y(n)')
+N = N1+N2-1
+//Padding zeros to Make Length of 'h' and 'x'
+//Equal to length of output response 'y'
+h1 = [h,zeros(1,8-N2)]
+x1 = [x,zeros(1,8-N1)]
+//Computing DFT
+H = dft(h1,-1)
+X = dft(x1,-1)
+//Multiplication of 2 DFTs
+Y = X.*H
+//Linear Convolution Result
+y =abs(dft(Y,1))
+for i =1:8
+ if(abs(H(i))<0.0001)
+ H(i) =0;
+ end
+ if(abs(X(i))<0.0001)
+ X(i) =0;
+ end
+ if(abs(y(i))<0.0001)
+ y(i) =0;
+ end
+end
+disp(X,'X=')
+disp(H,'H=')
+disp(y,'Output response using Convolution function')
+y = convol(x,h)