Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

1 t = linspace(0,6,1000);

2 f1 = 2*(t>=0) + 3*(t>=2) - 1*(t>=4) - 3*(t>=5);


3
4 alpha1 = 1/4;
5 beta1 = -1/4;
6 g1 = alpha1*f1 + beta1;
7
8 figure(1),subplot(221),plot(t,f1,'r','linewidth',2),ylim([0,6]),grid,legend('f_1(t)')
9 figure(1),subplot(223),plot(t,g1,'b','linewidth',2),ylim([-1,2]),grid,legend('g_1(t)')
10
11 t = linspace(0,6,1000);
12 f2 = 2*(t>=0) - 4*(t>=2) + 3*(t>=3) + 2*(t>=5);
13
14 alpha2 = 1/5;
15 beta2 = 2/5;
16 g2 = alpha2*f2 + beta2;
17
18 figure(1),subplot(222),plot(t,f2,'g','linewidth',2),ylim([-3,4]),grid,legend('f_2(t)')
19 figure(1),subplot(224),plot(t,g2,'k','linewidth',2),ylim([-1,2]),grid,legend('g_2(t)')
20
21 %%
22 t = linspace(0,6,1000);
23 f1 = 2*((-t+2)>=0); %+ 3*(t>=2) - 1*(t>=4) - 3*(t>=5);
24 figure(1),subplot(222),plot(t,f1,'g','linewidth',2),ylim([-3,4]),grid,legend('f_2(t)')

You might also like