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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
//example 3.23<i>
//Find the convolution sum
clear ;
close ;
clc ;
t= -5:1/100:5;
for i =1: length (t)
if t(i) <0 then
h(i)=0;
x(i)=0;
else
h(i)=2^t(i);
x(i)=1;
end
end
y = convol (x,h) ;
//figure
f=scf(0);
plot2d (t,h)
xtitle ( ' Input Re spons e ' , ' t ' , ' h ( t ) ' );
xs2jpg(0, 'problem32-plot-a.jpg');
//figure
f=scf(1);
plot2d (t,x)
xtitle ( ' Input Re spons e ' , ' t' , ' x ( t ) ' );
xs2jpg(1, 'problem32-plot-b.jpg');
//figure
f=scf(2);
a= gca ();
t1 = -10:1/100:10;
plot2d (t1 ,y)
xtitle ( ' Output Re spons e ' , ' t ' , ' y ( t) ' );
xs2jpg(2, 'problem32-plot-c.jpg');
//example 3.23<ii>
//Find the response using convolution sum
clear ;
clc;
close ;
t = -5:1/100:5;
for i =1: length (t)
if t(i) <0 then
h(i)=0;
x(i)=0;
elseif t(i)<3 then
h(i)=0;
x(i)=1;
else h(i)=1;x(i)=1;
end
end
y = convol (x,h) ;
//figure
f=scf(0);
plot2d (t,h)
xtitle ( ' Input Re spons e ' , ' t ' , ' h ( t ) ' );
xs2jpg(0, 'problem33-plot-a.jpg');
//figure
f=scf(1);
plot2d (t,x)
xtitle ( ' Input Re spons e ' , ' t ' , ' x ( t ) ' );
xs2jpg(1, 'problem33-plot-b.jpg');
//figure
f=scf(2);
a= gca ();
t1 = -10:1/100:10;
plot2d (t1 ,y)
xtitle ( ' Output Re spons e ' , ' t ' , ' y ( t ) ' );
xs2jpg(2, 'problem33-plot-c.jpg');
//example 3.23<iii>
//Find the response using convolution sum
clear ;
close ;
clc ;
t = -5:1/100:5;
for i =1: length (t)
if t(i) <0 then
h(i)=0;
x(i)=0;
elseif t(i)<1 then
h(i)=0;
x(i)=1;
elseif t(i)<=4 then h(i)=1;x(i)=1;
elseif t(i)<=7 then
h(i)=0;
x(i)=1;
end
end
y = convol (x,h) ;
//figure
f=scf(0);
plot2d (t,h)
xtitle ( ' Input Re spons e ' , ' t ' , ' h ( t ) ' );
xs2jpg(0, 'problem34-plot-a.jpg');
// figure
f=scf(1);
plot2d (t,x)
xtitle ( ' Input Re spons e ' , ' t ' , ' x ( t ) ' );
xs2jpg(1, 'problem34-plot-b.jpg');
//figure
f=scf(2);
t1 = -10:1/100:10;
plot2d (t1 ,y)
xtitle ( ' Output Re spons e ' , ' t ' , ' y ( t ) ' );
xs2jpg(2, 'problem34-plot-c.jpg');
|