diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /758/CH6/EX6.1/Ex_6_1.sce | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '758/CH6/EX6.1/Ex_6_1.sce')
-rwxr-xr-x | 758/CH6/EX6.1/Ex_6_1.sce | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/758/CH6/EX6.1/Ex_6_1.sce b/758/CH6/EX6.1/Ex_6_1.sce new file mode 100755 index 000000000..653fb1c54 --- /dev/null +++ b/758/CH6/EX6.1/Ex_6_1.sce @@ -0,0 +1,27 @@ +//Example 6.1
+clc;clear;close;
+x1=[1 1 2 2];
+x2=[1 2 3 4];
+ylength=length(x1);
+//Calculation of linear convolution
+z=convol(x1,x2);
+//Calculation of circular convolution
+for n=1:ylength
+ y(n)=0;
+ for k=1:ylength,
+ l=n-k+1;
+ if l <= 0 then
+ l=l+ylength;
+ end
+ y(n)=y(n)+(x1(k)*x2(l));
+ end
+end
+//Calculation of circular convolution using DFT and IDFT
+X1=dft(x1,-1);
+X2=dft(x2,-1);
+Y1=X1.*X2;
+y1=dft(Y1,1);
+y1=clean(y1);
+disp(z,'Linear Convolution sequence is z(n): ');
+disp(y,'Circular Convolution sequence is y(n): ');
+disp(y1,'Circular Convolution sequence calculated using DFT-IDFT method is y(n): ');
\ No newline at end of file |