summaryrefslogtreecommitdiff
path: root/52/CH3/EX3.18
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /52/CH3/EX3.18
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 '52/CH3/EX3.18')
-rwxr-xr-x52/CH3/EX3.18/Example3_18.sce36
1 files changed, 36 insertions, 0 deletions
diff --git a/52/CH3/EX3.18/Example3_18.sce b/52/CH3/EX3.18/Example3_18.sce
new file mode 100755
index 000000000..fc399e533
--- /dev/null
+++ b/52/CH3/EX3.18/Example3_18.sce
@@ -0,0 +1,36 @@
+//Example 3.18
+//Program to Compute output responce of following sequences
+//x[n]=[1,2,3,1]
+//h[n]=[1,1,1]
+//(1)Linear Convolution
+//(2)Circular Convolution
+//(3)Circular Convolution with zero padding
+clear;
+clc ;
+close ;
+x=[1,2,3,1];
+h=[1,1,1];
+//(1)Linear Convolution Computation
+ylinear=convol (x,h);
+//Display Linear Convoluted Sequence y[n] in command window
+disp(ylinear,"ylinear[n]=");
+//(2)Circular Convolution Computation
+//Now zero padding in h[n] sequence to make length of x[n] and h[n] equal
+h1=[h,zeros(1,1)];
+//Now Performing Circular Convolution by DFT method
+X=fft(x,-1);
+H=fft(h1,-1);
+Y=X.*H;
+ycircular=fft(Y,1);
+//Display Circular Convoluted Sequence y[n] in command window
+disp(ycircular,"ycircular[n]=");
+//(3)Circular Convolution Computation with zero Padding
+x2=[x,zeros(1,2)];
+h2=[h,zeros(1,3)];
+//Now Performing Circular Convolution by DFT method
+X2=fft(x2,-1);
+H2=fft(h2,-1);
+Y2=X2.*H2;
+ycircularp=fft(Y2,1);
+//Display Circular Convoluted Sequence with zero Padding y[n] in command window
+disp(ycircularp,"ycircularp[n]="); \ No newline at end of file