summaryrefslogtreecommitdiff
path: root/2294/CH8/EX8.14/EX8_14.sce
blob: f8a47fbc183f7cff0c12f111f941459a3d05ba85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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)');