summaryrefslogtreecommitdiff
path: root/62/CH1/EX1.4/ex_1_4.sce
blob: 26cf28d870f91b52354d1f627cdce2d6ba051155 (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
//ex_4 combining two discrete signals
clear;
clc;
close;
t1=-2:7
t2=-3:4
x1=[0 0 0 1 2 3 0 0 2 2 0];
x2=[0 -2 -2 2 2 0 -2 0 0 0 0];
t3=min(t1(1),t2(1)):max(t1(length(t1)),t2(length(t2)));
figure
a=gca();
plot2d3(t3,x1)
plot(t3,x1,'r.')
xtitle('x1[n]')
figure
a=gca();
plot2d3(t3,x2)
plot(t3,x2,'r.')
xtitle('x2[n]')
a.x_location='middle'
figure
a=gca();
plot2d3(t3,x1+x2)
plot(t3,x1+x2,'r.')
xtitle('y1[n]=x1[n]+x2[n]')
a.x_location='origin'
figure
a=gca();
plot2d3(t3,2.*x1)
plot(t3,2.*x1,'r.')
xtitle('y2[n]=2 * x1[n]')
figure
a=gca();
plot2d3(t3,x1.*x2)
plot(t3,x1.*x2,'r.')
xtitle('y2[n]=x2[n] * x1[n]')