94 C H A P T E R 1: Continuous-Time Signals
FIGURE 1.8
Generation of
y(t)= 3 r(t+ 3 )− 6 r(t+ 1 )+ 3 r(t)−
3 u(t− 3 ),− 5 ≤t≤ 5 , and zero otherwise.− 5 0 5− 101234567t(sec)y(t)y3 = ramp(t,3,-2);
y4 = ustep(t,-4);
y = y1 + y2 + y3 + y4;
plot(t,y,’k’); axis([-5 5 -3 5]); gridThe signaly(t)=0 fort<−5 andt>5.SolutionThe signaly(t)displayed on Figure 1.9(a) is given analytically byy(t)= 2 r(t+2.5)− 5 r(t)+ 3 r(t− 2 )+u(t− 4 )Clearly,y(t)is neither even nor odd. To find its even and odd components we use the function
evenodd, shown in the following code with inputs as the signal and its support and outputs as the
even and odd components. The results are shown on the bottom plots of Figure 1.9. Adding these
two signals gives back the original signaly(t). The script used is as follows.
%%%%%%%%%%%%%%%%%%%
% Example 1.17
%%%%%%%%%%%%%%%%%%%
[ye, yo] = evenodd(t,y);
subplot(211)
plot(t,ye,’r’)
grid
axis([min(t) max(t) -2 5])
subplot(212)
plot(t,yo,’r’)