summaryrefslogtreecommitdiff
path: root/2294/CH3/EX3.21/EX3_21.sce
blob: 62f6d131bc5b21dcb477d3d47d788c5ae024282b (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
//Example 3.21
//Determine the response of the below relaxed system.
clc;
close;
 n=-10:.01:10;
 for i=1:length(n)
     if n(i)<0 then
         h(i)=0;x(i)=0;
     else
         h(i)=(1/3)^n(i);
         x(i)=2^n(i);
     end
 end
 y=convol(h,x);
 //figure
 f=scf(0);
 plot(n,h,'black');
 xtitle('input response1','n','h(n)');
 xs2jpg(0, 'problem29-plot-a.jpg');
// figure
f=scf(1);
 plot(n,x,'red');
 xtitle('input response2','n','x(n)');
 xs2jpg(1, 'problem29-plot-b.jpg');
// figure
f=scf(2);
 n1=-20:.01:20;
 plot(n1,y,'green');
 xtitle('output response','n','y(n)');
 xs2jpg(2, 'problem29-plot-c.jpg');