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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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)');
|