summaryrefslogtreecommitdiff
path: root/2294/CH8
diff options
context:
space:
mode:
Diffstat (limited to '2294/CH8')
-rwxr-xr-x2294/CH8/EX8.14/EX8_14.sce38
-rwxr-xr-x2294/CH8/EX8.19/EX8_19.sce81
-rwxr-xr-x2294/CH8/EX8.25/EX8_25.sce12
-rwxr-xr-x2294/CH8/EX8.26/EX8_26.sce12
-rwxr-xr-x2294/CH8/EX8.27/EX8_27.sce12
-rwxr-xr-x2294/CH8/EX8.28/EX8_28.sce16
-rwxr-xr-x2294/CH8/EX8.29/EX8_29.sce36
7 files changed, 207 insertions, 0 deletions
diff --git a/2294/CH8/EX8.14/EX8_14.sce b/2294/CH8/EX8.14/EX8_14.sce
new file mode 100755
index 000000000..f8a47fbc1
--- /dev/null
+++ b/2294/CH8/EX8.14/EX8_14.sce
@@ -0,0 +1,38 @@
+
+//Example 8.14
+//Find the convolution of the signals given below using fourier transform
+clc;
+clear all;
+n=-10:10;
+for i=1:length(n)
+ if n(i)>=0 then
+ x1(i)=(1/2)^n(i);
+ x2(i)=(1/3)^n(i);
+ else
+ x1(i)=0;
+ x2(i)=0;
+ end
+end
+subplot(3,2,1)
+plot(x1,n);
+xtitle('(a) x1(n)');
+subplot(3,2,2)
+plot(x2,n);
+xtitle('(b) x2(n)');
+X1=fft(x1,-1);
+X2=fft(x2,-1);
+subplot(3,2,3)
+plot(X1,n);
+xtitle('(c) X1(n)');
+subplot(3,2,4)
+plot(X2,n);
+xtitle('(d) X2(n)');
+X3=X2.*X1;
+subplot(3,2,5)
+plot(X3,n);
+xtitle('(e) X3(n)');
+x3=fft(X3,1);
+disp(x3,'The result of convolution is:');
+subplot(3,2,6)
+plot(x3,n);
+xtitle('(f) x3(n)');
diff --git a/2294/CH8/EX8.19/EX8_19.sce b/2294/CH8/EX8.19/EX8_19.sce
new file mode 100755
index 000000000..1d6b00c14
--- /dev/null
+++ b/2294/CH8/EX8.19/EX8_19.sce
@@ -0,0 +1,81 @@
+
+//Example 8.19.1
+//Use fourier transform to determine the response of the following signal
+clc;
+clear all;
+n=-10:10
+for i=1:length(n)
+ if n(i)>=1 then
+ x(i)=(3/4)^n(i);
+ h(i)=(1/2)^n(i);
+ else
+ x(i)=0;
+ h(i)=0;
+ end
+end
+subplot(3,2,1)
+plot(x,n);
+xtitle('(a)x(n)');
+subplot(3,2,2)
+plot(h,n);
+xtitle('(b)h(n)');
+X=fft(x,-1);
+H=fft(h,-1);
+subplot(3,2,3)
+plot(X,n);
+xtitle('(c)X(n)');
+subplot(3,2,4)
+plot(H,n);
+xtitle('(d)H(n)');
+Y=H.*X;
+subplot(3,2,5)
+plot(Y,n);
+xtitle('(e)Y(n)');
+y=fft(Y,1);
+disp(y,'The output response is:');
+subplot(3,2,6)
+plot(y,n);
+xtitle('(f)y(n)');
+
+
+clf()
+
+//Example 8.19.2
+//Use fourier transform to determine the response of the following signal
+clc;
+clear;
+n=-10:10
+for i=1:length(n)
+ if n(i)>=1 then
+ x(i)=(-1)^n(i);
+ h(i)=(1/2)^n(i);
+ else
+ x(i)=0;
+ h(i)=0;
+ end
+end
+subplot(3,2,1)
+plot(x,n);
+xtitle('x(n)');
+subplot(3,2,2)
+plot(h,n);
+xtitle('h(n)');
+X=fft(x,-1);
+H=fft(h,-1);
+subplot(3,2,3)
+plot(X,n);
+xtitle('X(n)');
+subplot(3,2,4)
+plot(H,n);
+xtitle('H(n)');
+Y=H.*X;
+subplot(3,2,5)
+plot(Y,n);
+xtitle('Y(n)');
+y=fft(Y,1);
+disp(y,'The output response is:');
+subplot(3,2,6)
+plot(y,n);
+xtitle('y(n)');
+
+
diff --git a/2294/CH8/EX8.25/EX8_25.sce b/2294/CH8/EX8.25/EX8_25.sce
new file mode 100755
index 000000000..09e88f072
--- /dev/null
+++ b/2294/CH8/EX8.25/EX8_25.sce
@@ -0,0 +1,12 @@
+//Example 8.25.1
+//Find idft of the following
+clc;
+X=[1 1-%i*2 -1 1+%i*2];
+x=fft(X,1);
+disp(x);
+//Example 8.25.2
+//Find idft of the following
+clc;
+X=[1 0 1 0];
+x=fft(X,1);
+disp(x);
diff --git a/2294/CH8/EX8.26/EX8_26.sce b/2294/CH8/EX8.26/EX8_26.sce
new file mode 100755
index 000000000..a58de6312
--- /dev/null
+++ b/2294/CH8/EX8.26/EX8_26.sce
@@ -0,0 +1,12 @@
+
+//Example 8.26
+//Find the circular convolution of two sequences
+clc;
+clear all;
+x1=[1 2 3 4];
+x2=[1 -1 2 1];
+X1=fft(x1,-1);
+X2=fft(x2,-1);
+X3=X1.*X2;
+x3=fft(X3,1);
+disp(x3,'The circular convolution is:');
diff --git a/2294/CH8/EX8.27/EX8_27.sce b/2294/CH8/EX8.27/EX8_27.sce
new file mode 100755
index 000000000..15af19547
--- /dev/null
+++ b/2294/CH8/EX8.27/EX8_27.sce
@@ -0,0 +1,12 @@
+
+//Example 8.27
+//Find the circular convolution of the following sequences
+clc;
+clear all;
+x1=[1 -1 2 3];
+x2=[0 1 2 3];
+X1=fft(x1,-1);//To obtain fourier transform of x1, -1 is taken.
+X2=fft(x2,-1);
+X3=X1.*X2;
+x3=fft(X3,1);//+1 to obtain inverse fourier transform.
+disp(x3,'Circular convolution of the above two sequences is:');
diff --git a/2294/CH8/EX8.28/EX8_28.sce b/2294/CH8/EX8.28/EX8_28.sce
new file mode 100755
index 000000000..8821bc42c
--- /dev/null
+++ b/2294/CH8/EX8.28/EX8_28.sce
@@ -0,0 +1,16 @@
+
+//Example 8.28
+//Find the linear and circular convolution
+clc;
+clear all;
+x1=[1 2 3 4];
+x2=[2 3 4 1];
+//Linear convolution
+z=convol(x1,x2);
+disp(z,'The linear convolution is:');
+//To obtain circular convolution
+X1=fft(x1,-1);
+X2=fft(x2,-1);
+X3=X1.*X2;
+x3=fft(X3,1);
+disp(x3,'The circular convolution is:');
diff --git a/2294/CH8/EX8.29/EX8_29.sce b/2294/CH8/EX8.29/EX8_29.sce
new file mode 100755
index 000000000..35ac651ad
--- /dev/null
+++ b/2294/CH8/EX8.29/EX8_29.sce
@@ -0,0 +1,36 @@
+//Find dft of the following sequence
+//Example 8.29.1
+clc;
+n=-10:10;
+for i=1:length(n)
+ if n(i)==0 then
+ x(i)=1;
+ else
+ x(i)=0;
+ end
+end
+y=fft(x,-1);
+disp(y,'The dft of the sequence is:');
+//Find dft of the following sequence
+//Example 8.29.2
+clc;
+n=-10:10;n0=2;
+for i=1:length(n)
+ if n(i)==n0 then
+ x(i)=1;
+ else
+ x(i)=0;
+ end
+end
+y=fft(x,-1);
+disp(y,'The dft of the sequence is:');
+//Find dft of the following sequence
+//Example 8.29.3
+clc;
+n=-10:10;a=2;
+for i=1:length(n)
+ x(i)=a^n(i);
+end
+y=fft(x,-1);
+disp(y,'The dft of the sequence is:');
+