summaryrefslogtreecommitdiff
path: root/2303/CH5/EX5.9/5_9.sce
diff options
context:
space:
mode:
Diffstat (limited to '2303/CH5/EX5.9/5_9.sce')
-rwxr-xr-x2303/CH5/EX5.9/5_9.sce27
1 files changed, 27 insertions, 0 deletions
diff --git a/2303/CH5/EX5.9/5_9.sce b/2303/CH5/EX5.9/5_9.sce
new file mode 100755
index 000000000..792417b89
--- /dev/null
+++ b/2303/CH5/EX5.9/5_9.sce
@@ -0,0 +1,27 @@
+//Example 5.9
+clc;
+clear;
+close;
+
+//let
+x=[1 2 3 4];
+h=[5 6 7];
+M=length(x);
+N=length(h);
+
+//Result of linear convolution of original sequences
+y=conv(x,h);
+disp(y,"Result of linear convolution of original sequences is");
+
+L=M+N-1;
+//we append zeros such that total sequence will have length 6.
+x=[zeros(1:2),x];
+h=[h,zeros(1:2)];
+
+//Result of circular convolution of sequence appended with 2 zeros at start
+y=conv(x,h);
+y(11:12)=0;
+y=y(1:6)+y(7:12)
+disp(y,"Result of circular convolution of sequences appended with 2 zeros at start is");
+
+disp("We see that if we circularly rotate the result of circular convolution by 2 samples, we get the linear convolution result");