summaryrefslogtreecommitdiff
path: root/62/CH2/EX2.6/ex_2_6.sce
blob: 9ff4644cdbb6206c981a603479c98deeafc93d20 (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
39
40
41
42
43
//Example 2.6:Convolution Integral 
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)<=2
        h(i)=1;
        x(i)=1;
    elseif t(i)<=3
        h(i)=0;
        x(i)=1;
    else
        h(i)=0;
        x(i)=0; 
    end
end
y = convol(x,h)./100;
figure
a=gca();
a.x_location="origin";
plot2d(t,h) 
xtitle('Impulse Response','t','h(t)');
a.children.children.thickness = 3;
a.children.children.foreground= 2;
figure
a=gca();
plot2d(t,x) 
xtitle('Input Response','t','x(t)');
a.children.children.thickness = 3;
a.children.children.foreground= 2;
figure
a=gca();
t1=-10:1/100:10;
a.y_location="origin";
a.x_location="origin";
plot2d(t1,y) 
xtitle('Output Response','t','y(t)');
a.children.children.thickness = 3;
a.children.children.foreground= 2;