summaryrefslogtreecommitdiff
path: root/2294/CH1/EX1.22/EX1_22.sce
blob: 977f731ebd5471e11987a0b65a5b749e11a812f2 (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
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
//Example 1.22<i>
//Find whether the given signal is causal or not.
clear all;
clc;
t=-10:10;
a=.5;
for i=1:length(t)
    if t(i)<0 then
        x1(i)=0;
    else
        x1(i)=exp(a.*t(i));
    end
end
causal=%t;
for i=1:length(t)
    if t(i)<0 & x1(i)~=0 then
        causal=%f;
    end
end
disp(causal,"The statement that the system is causal is:");
//Example 1.22<ii>
//Find whether the given signal is causal or not.
clear all;
clc;
t=-10:10;
for i=1:length(t)
    if t(i)>0 then
        x2(i)=0;
    else
        x2(i)=exp(-2.*t(i));
    end
end
causal=%t;
for i=1:length(t)
    if t(i)<0 & x2(i)~=0 then
        causal=%f;
    end
end
disp(causal,"The statement that the system is causal is:");
//Example 1.22<iii>
//Find whether the given signal is causal or not.
clear all;
clc;
t=-10:10;
c=2;
for i=1:length(t)
    x3(i)=sin(c.*t(i));
    end
causal=%t;
for i=1:length(t)
    if t(i)<0 & x3(i)~=0 then
        causal=%f;
    end
end
disp(causal,"The statement that the system is causal is:");
//Example 1.22<iv>
//Find whether the given signal is causal or not.
clear all;
clc;
n=-10:10;
for i=1:length(n)
    if n(i)<-3 | n(i)>2 then
        x1(i)=0;
    else
        x1(i)=1;
    end
    end
causal=%t;
for i=1:length(n)
    if n(i)<0 & x1(i)~=0 then
        causal=%f;
    end
end
disp(causal,"The statement that the system is causal is:");
//Example 1.22<v>
//Find whether the given signal is causal or not.
clear all;
clc;
n=-10:10;
for i=1:length(n)
    if  n(i)>-2 then
        x2(i)=(1/2)^n(i);
    else
        x2(i)=0;
    end
    end
causal=%t;
for i=1:length(n)
    if n(i)<0 & x2(i)~=0 then
        causal=%f;
    end
end
disp(causal,"The statement that the system is causal is:");