summaryrefslogtreecommitdiff
path: root/62/CH1/EX1.22/ex_1_22.sce
blob: 6728e510c632554b1a48cb492c44f8a8ff9d6700 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//ex_22 product of x(t) and unit step function
clear x;
clear t;
clear;
clear y;
clc;
close;
t=-1:1/100:2
for i=1:(length(t))
    if t(i)<0 then
        x(i)=t(i)+1;
    elseif t(i)<1
        x(i)=1
    else
        x(i)=2
    end
end
figure
a=gca();
plot2d(t,x)
a.y_location='origin'
xtitle('x(t)','t')
//a.x(t)*u(1-t)
for i = 1:(length(t))
    if t(i)<1  then
        u1(i)=1
    else
        u1(i)=0
    end
end
y=x.*u1
figure
a=gca();
plot2d(t,y)
a.y_location='origin'
xtitle('x(t)*u(1-t)','t')
for i = 1:(length(t))
    if t(i)<1 & t(i)>0 then
        u2(i)=1
    else
        u2(i)=0
    end
end
y=x.*u2;
figure
a=gca();
plot2d(t,y)
a.y_location='origin'
xtitle('x(t)*u(t-1)','t')
for i = 1:(length(t))
    if t(i)==3/2 then
        z(i)=x(i)
    else
        z(i)=0
    end
end
figure
a=gca();
plot2d3(t,z)
poly_1=a.children.children;
poly_1.thickness=3;
a.y_location='origin'
xtitle('x(t)*delta(t-3/2)','t')