From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 758/CH6/EX6.1/Ex_6_1.sce | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 758/CH6/EX6.1/Ex_6_1.sce (limited to '758/CH6/EX6.1/Ex_6_1.sce') 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 -- cgit