程序代写代做代考 graph algorithm 4

4
Time Domain System Analysis
In this chapter, we introduce the concept of impulse response of a system and we discuss the possible interconnections between two or more systems. Moreover, the process of convolution, which is one of the most important concepts in signals and systems theory, is established for both continuous- and discrete-time systems. Furthermore, we present how a system can be described by a differential or a difference equation, and finally we discuss the finite impulse response and infinite impulse response filters.
4.1 Impulse Response
The meaning of impulse response of a system is easily derived if one considers the terms that it is named from. The term, ‘‘response,’’ denotes the output of a system, while the term, ‘‘impulse,’’ denotes that the input signal applied to the system is the unit impulse or Dirac delta function. Hence,
This relationship is graphically illustrated in the block diagram representa- tion shown in Figure 4.1. The impulse response is usually denoted by h(t). Mathematically, the above definition is expressed as
h(t) 1⁄4 Sfd(t)g: (4:1)
4.2 Continuous-Time Convolution
any input signal. We now present one of the most important topics in signals and systems theory.
Suppose that y(t) denotes the output of the system, x(t) is the input signal, and h(t) is the impulse response of the system. The mathematical expression of the convolution relationship is
y(t) 1⁄4 x(t) * h(t), (4:2) 179
the impulse response of a causal linear and time-invariant
continuous-time system is its output when the Dirac delta function is the input applied
to the system.
The impulse response of a linear time-invariant system completely specifies the system.
More specifically, if the impulse response of a system is known one can compute the
system output for
The response (or output) of a system to any input signal is computed by the convolution of the input signal with the impulse response of the system:

180 Signals and Systems Laboratory with MATLAB1
FIGURE 4.1
Block diagram representation of system S. The signal x(t)1⁄4d(t) is the input signal applied to the system; that is, the Dirac delta function is the input signal, and the output of the system is y(t)1⁄4h(t); that is, the output of the system is the system impulse response.
Output δ(t) h(t)
y(t) 1⁄4 x(t) * h(t) 1⁄4
Equations 4.3 and 4.4 are equivalent and express the convolution integral.
4.2.1 Computation of Convolution
In order to calculate the convolution between two signals, a specific (and not exactly trivial) computational procedure has to be followed. The convolution computational procedure is introduced through an example.
Example
A linear time-invariant system is described by the impulse response
h(t)1⁄4&1″t, 0 t 1: 0, elsewhere
Calculate the response of the system to the input signal
x(t)1⁄4&1, 0 t 2: 0, elsewhere
In order to compute the convolution between x(t) and h(t) the computational procedure is implemented in the following steps.
h(t)1⁄4&1″t, 0 t 1 and x(t)1⁄4&1″t, 0 t 1 0, elsewhere 0, elsewhere
are defined and plotted.
“1
1ð “1
Input
System S {.}
where the symbol * denotes convolution, and it must not be confused with the multiplica- tion symbol. The calculation of the convolution between two signals involves the compu-
tation of an integral. The complete form of (4.2) is

convolution can be between two signals or a signal and an impulse response
y(t) 1⁄4 x(t) * h(t) 1⁄4
By alternating variables t and t, Equation 4.3 becomes
x(t)h(t ” t)dt: (4:3)
# h(t) may be a signal or it can be an impulse response
# convolution follows commutative property x(t)*h(t)=h(t)*x(t)
x(t ” t)h(t)dt: (4:4)
Step 1: The input and impulse response signals are plotted in the t-axis; that is, t is replaced
with t, or in other words the signals

Time Domain System Analysis
181
Commands
tx1 1⁄4 “2:.1:0;
tx2 1⁄4 0:.1:2;
tx3 1⁄4 2:.1:4;
tx 1⁄4 [tx1 tx2 tx3];
x1 1⁄4 zeros(size(tx1)); x2 1⁄4 ones(size(tx2)); x3 1⁄4 zeros(size(tx3)); x 1⁄4 [x1 x2 x3];
th1 1⁄4 “2:.1:0; 1 th2 1⁄4 0:.1:1;
th3 1⁄4 1:.1:4;
th 1⁄4 [th1 th2 th3];
h1 1⁄4 zeros(size(th1));
h2 1⁄4 1″th2;
h3 1⁄4 zeros(size(th3)); 0.4 h 1⁄4 [h1 h2 h3]; plot(tx,x,th,h,‘:*’) ylim([“.1 1.1]) legend(‘x(\tau)’,‘h(\tau)’) grid
Results
Comments
The signals x(t) and h(t) are defined in the usual way of constructing two- part functions. The input signal x(t) is plotted with solid line, while the impulse response signal h(t) is plotted with dotted line and asterisks. Both signals are defined in the time interval “2 t 4. Notice that signals are plotted in the t-axis and how Greek letters are inserted into the legend.
Commands
plot(tx,x,”th,h, ‘:*’) legend(‘x(\tau)’, ‘h(“\tau)’) ylim([“.1 1.1])
Results
0.8 0.6
0.2
0
−2 −1 0 1 2 3 4
Step 2: The second step is known as reflection. One of the two signals is selected (in this example h(t) is chosen, but x(t) could have been also selected) and its symmetric with respect to the vertical axis, i.e., h(“t) is plotted.
1 0.8 0.6 0.4 0.2
x(τ) h(−τ)
0
−4 −3 −2 −1 0 1 2 3 4
x(τ) h(τ)

182
Signals and Systems Laboratory with MATLAB1
Step 3: The third step is shifting. The signal h(“t) is shifted by t; that is, the signal h(t “t) is plotted. Note that t is a constant, as the variable of the defined signals is variable t.
Commands
Results
Comments
The signal h(t”t) is plotted for t 1⁄4 “2. Notice that h(t ” t) is shifted by 2 units to the left compared to h(“t).
1 0.8 0.6 legend(‘x(\tau)’,‘h(t”\tau)’) 0.4 0.2 0
x(τ) h(t−τ)
t 1⁄4 “2; plot(tx,x,”thþt,h,‘:*’) ylim([“.1 1.1])
−6 −5 −4 −3 −2 −1 0 1 2 3 4
A very useful (for the future computations) observation is the point in the t-axis where the right end of h(t”t) is. The right end of h(t”t) for t1⁄4″2; that is, the right end of h(“2″t) is at the point t 1⁄4 “2. In the previous graph, we observe that the right end of h(“t), that is, the right end of h(0 ” t) is at t 1⁄4 0. Hence, we conclude that in the general case the right end of h(t”t) is at the point t1⁄4t. On the other hand, the left end of h(t”t) is at t1⁄4t”T, where T is the duration of h(t ” t). In this example T 1⁄4 1.
Step 4:
. First stage: Zero overlap Commands
t 1⁄4 “2; plot(tx,x,”thþt,h,‘:*’) ylim([“.1 1.1])
Results
0
−6 −5 −4 −3 −2 −1 0 1 2 3 4
Comments
The fourth step is the sliding step. The value of the output signal y(t) at time t, that is, the
value of the convolution between the input signal and the impulse response signal at time t,
depends on the overlap between x(t) and h(t ” t) at time t.
for all t we have to slide the signal h(t ” t) from “1 toward þ1 and to derive the kind (or stage) of overlap in reference to the value of t. Note that the signal x(t) remains still.
In order to compute the convolution
1
0.8
0.6
For
t1⁄4″2) the signals h(t”t) and x(t) do not overlap. Thus, the output is y(t) 1⁄4 0.
x(τ) h(t−τ)
t < 0 (in this figure 0.4 legend(‘x(\tau)’,‘h(t"\tau)’) 0.2 Time Domain System Analysis 183 . Second stage: Partial overlap Commands Results Comments For 03, the signal h(t ” t) does not overlap with x(t). Hence, the output is y(t) 1⁄4 0.
x(τ) h(t−τ)
0.6
1
ZERO OVERLAP STAGE
0
−2 −1 0 1 2 3 4 5 6
Step 5: Specification of the limits and calculation of the convolution integral. Having derived the time intervals for the various stages of overlap, the convolution integral is computed separately for each stage. Before computing the integrals the integration limits have to be specified. Recall that the right end of the signal h(t ” t) is at the point t 1⁄4 t, while the left end of h(t”t) is at the point t1⁄4t”T1⁄4t”1. Hence,
1. For t < 0, the two signals do not overlap (zero-overlap stage). Thus, the response of the system is y(t) 1⁄4 0. 2. For 03, there is no overlap; thus, the output is y(t)1⁄40, t>3.
The response of the system at the exit stage is y(t) 1⁄4 (3″t)2/2, 2<>: t ” t2=2, 0 t 1 y(t)1⁄4 1=2, 2 1 t 2 >(3″t)=2, 2 t 3
0, t < 0 and t > 3
:
Finally, the output y(t) is plotted in MATLAB1 according to the technique of plotting multipart functions.

186
Signals and Systems Laboratory with MATLAB1
Commands
t1 1⁄4 0:.1:1;
t2 1⁄4 1:.1:2;
t3 1⁄4 2:.1:3;
y1 1⁄4 t1″(t1.^ 2)=2;
y2 1⁄4 0.5*ones(size(t2));
y3 1⁄4 0.5*( (3″t3).^ 2); plot(t1,y1,t2,y2,‘.’,t3,y3,‘:’) ylim([0 0.6])
title(‘Output signal y(t)’);
Results
Output signal y(t)
0.5 0.4 0.3 0.2 0.1
00 0.5 1 1.5 2 2.5 3
4.2.2 The Command conv
The computational process followed in the previous chapter is the analytical way of
deriving the convolution between two signals.
In order to illustrate the conv command we consider the previously used example, namely, an impulse response signal given by h(t)1⁄41″t, 0 t 1 and an input signal given by x(t)1⁄41, 0 t 2. There are four rules that have to be applied for successfully computing the convolution between
two continuous-time signals. . First rule:
Hence, both signals are defined in the time interval a t b, where t 1⁄4 a is the first time instance that at least one of the signals x(t) or h(t) is not zero and t 1⁄4 b is the last time instance that at least one of the two signals is not zero. In our example the time interval is 0 t 2. Thus the input signal is x(t) 1⁄4 1, 0
t 2 and the impulse response signal is expressed as
h(t)1⁄4&1″t, 0 t 1: 0, 1t2
. Second rule: When a signal consists of multiple parts, the time intervals in which each part is defined must not overlap. Therefore the impulse response signal is defined as
h(t)1⁄4&1″t, 0 t 1: 0, 1 3

190 Signals and Systems Laboratory with MATLAB1
stage is also given. Next, the result is confirmed by computing the output of the system with use of the conv command in two slightly different ways. Notice that the input signal consists of two nonzero parts. This fact complicates the computational process.
Step 1: The input and impulse response signals are defined and plotted in the t-axis.
Commands
Results
1
0.9 x(τ)
h(τ)
Comments
Notice that a zero element is embedded into the impulse response vector and its corresponding time vector. This is done in order to plot the vertical line att1⁄40.
th1 1⁄4 linspace(0,10,1001); 0.8 h1 1⁄4 exp(“th1); 0.7 h 1⁄4 [0 h1]; 0.6 th 1⁄4 [0 th1]; 0.5 tx1⁄4[“1 “1 0.5 0.5 3 3];
x1⁄4[0 0.6 0.6 0.3 0.3 0]; 0.4 plot(tx,x, ‘:’,th,h) 0.3 legend(‘x(\tau)’,‘h(\tau)’) 0.2
0.1
0
−2 0 2 4 6 8 10
Steps 2–5: For briefness, Steps 2 through 5 of the computational process are combined; that is, we slide the signal h(t”t) from “1 to þ1 and compute the convolution integrals within the appropriate limits at various stages.
. First stage: Zero overlap. Commands
t1⁄4″3
plot(tx,x,‘:’,”thþt,h) legend(‘x(\tau)’,‘h(t”\tau)’)
0.4
0.3
0.2
0.1
Results
1
0.9
0.8
0.7
0.6
0.5
x(τ) h(t−τ)
0
−14 −12 −10 −8 −6 −4 −2 0 2 4
For t < "1, the input and impulse response signals do not overlap; thus the output of the system is y(t) 1⁄4 0. Time Domain System Analysis 191 . Second stage: Partial overlap of h(t " t) with the first part of x(t). Commands t1⁄4"0.3 plot(tx,x,‘:’,"thþt,h) legend(‘x(\tau)’,‘h(t"\tau)’) Results 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 x(τ) h(t−τ) −12 −10 −8 −6 −4 −2 0 2 4 For " 1 < t < 0.5, the impulse response signal h(t " t) overlaps partially with the first part of x(t), while there is no overlap with the second part of x(t). The convolution integral in this stage is computed as "1 The result is verified in MATLAB. ðt x(t)h(t " t)dt 1⁄4 0:6e"(t"t)dt ðt "1ðt "1 y(t) 1⁄4 1⁄4 0:6e"t etdt 1⁄4 0:6 " 0:6e"t"1: Commands syms t r f1⁄40.6*exp("(t"r)); y 1⁄4 int(f,r,"1,t) Results=Comments y 1⁄4 3=5"3=5*exp("t"1) Notice that the value of x(t) for"1 3. The convolution integral is calculated as
0:5 3 0:5 3
y(t) 1⁄4 ð 0:6e”(t”t)dt þ ð 0:3e”(t”t)dt 1⁄4 0:6e”t ð etdt þ 0:3e”t ð etdt
“1 0:5 “1 0:5
1⁄4 0:6e”t(e0:5 ” e”1) þ 0:3e”t(e3 ” e0:5) 1⁄4 0:3e”tþ0:5 ” 0:6e”t”1 þ 0:3e”tþ3:
In MATLAB, the above expression is computed as follows.
Commands
syms t r
f11⁄40.6*exp(“(t”r));
f2 1⁄4 0.3*exp(“(t”r));
y 1⁄4 int(f1,r,”1,0.5)þint(f2,r,0.5,3)
Results
y 1⁄4 3=10*exp(“tþ1=2)”3=5*exp(“t”1) þ3=10*exp(“tþ3)
An additional stage could be expected, the one that h(t”t) exits from x(t). However, looking into the definition of
h(t)1⁄4e”tu(t)1⁄4&e”t, t!0, 0, t<0 we see that h(t) (theoretically) is nonzero for any t 2 [0, þ1). Therefore, h("t) is nonzero for any t 2 ("1,0], and h(t"t) is nonzero for any t 2 ("1, t]. Thus, for t>3, the signals h(t ” t) and x(t) completely overlap. Consequently, there is no exit stage in the convolution computational process of this example. Assembling the expressions calculated for the output at the various stages of convolution, the response of the system to the input signal x(t) is given by
8> 0,
y(t) 1⁄4 <>: 0:6 ” 0:6e”t”1,
> 0:3e”tþ0:5 ” 0:6e”t”1 þ 0:3, 0:3e”tþ0:5 ” 0:6e”t”1 þ 0:3e”tþ3,
t < "1 "1 t 0:5 : 0:5 t 3 t > 3
The system response is plotted using the technique of plotting piecewise functions.

194
Commands
Signals and Systems Laboratory with MATLAB1 Results
t1 1⁄4 “1:.1:0.5;
y1 1⁄4 0.6*(1″exp(“1″t1));
t2 1⁄4 0.5:.1:3;
y2 1⁄4 0.3*exp(“t2þ0.5)”0.6*exp(“t2″1)þ0.3
t3 1⁄4 3:.1:10;
y3 1⁄4 0.3*exp(“t3)*(exp(0.5)”2*exp(“1)þexp(3)); t 1⁄4 [t1 t2 t3];
y 1⁄4 [y1 y2 y3];
plot(t,y)
title(‘Output signal y(t)’)
0−2 0 2 4 6 8 10
0.5 0.45 0.4 0.35 0.3 0.25 0.2 0.15 0.1 0.05
Output signal y(t)
Next, two slightly different approaches implemented in MATLAB in order to calculate again the convolution between the input signal
(0:6, “1 t<0:5 x(t) 1⁄4 0:3, 0:5 t 3 0, t < "1 and t > 3
and the impulse response signal h(t)1⁄4e”tu(t) are illustrated. In order to implement the computation in MATLAB an assumption must be made. As mentioned earlier, the signal h(t) 1⁄4 e”tu(t) is nonzero for t ! 0. Therefore, in MATLAB it should be defined over the time interval [0, þ1). Of course, this is not possible. From the graph of h(t), we notice that for t > 10 its value approaches zero. Thus, considering that h(t) 1⁄4 0, t > 10 makes no difference from a practical viewpoint. So from now on, any function of the form f(t) 1⁄4 e”atu(t), a ! 1 will be defined as f(t) 1⁄4 e”at(u(t) ” u(t ” 10)) 1⁄4 e”at, 0 t 10.
First approach: The input signal x(t) is shifted by one unit to the right in order to have nonzero value from the time instance t 1⁄4 0. In other words, the input signal is now given by
(0:6, 0 t<1:5 x(t)1⁄4 0:3, 1:5 t 4: 0, t>4
This time shift does not cause any problem as the system is time invariant. After the convolution process is completed, the computed output has to be shifted back by one unit to the left. The shift-back operation is implemented when we plot the output signal.

Time Domain System Analysis
195
Commands Results
Comments
The first rule is applied; that is, the input and impulse response signals are defined over the same time interval (0 t 10), while the partial time intervals are constructed in a way that they do not over- lap (second rule).
The output of the system is computed by multiplying the result of the convolution with the time step (third rule).
The output is plotted in the double time interval (fourth rule). Notice that the output signal is shifted by one unit to the left since the input signal was shifted one unit to the right.
t1 1⁄4 [0:0.01:1.5];
t2 1⁄4 [1.5þ0.01:0.01:4] t3 1⁄4 [4.01:0.01:10];
x1 1⁄4 0.6*ones(size(t1)); x2 1⁄4 0.3*ones(size(t2)); x3 1⁄4 zeros(size(t3));
x 1⁄4 [x1 x2 x3];
h 1⁄4 exp(“[t1 t2 t3]);
y 1⁄4 conv(x,h)*0.01;
plot(“1:0.01:19, y) 0.3 0.25
title(‘Output signal y(t)’) 0.2
0.15 0.1 0.05
0.5 0.45 0.4 0.35
Output signal y(t)
0−5 0 5 10 15 20
The response of the system obtained is the same as the one derived with the analytical approach.
Second approach: The input and impulse response are defined in the same (the wider) time interval, i.e., in the time interval “1 t 10. Thus the two signals are now given by
8<: 0:6, "1 t 0:5 & 0, "1 t < 0 x(t)1⁄4 0:3, 0:52 there is overlap between
For t1⁄42 the signal 0.8 h(t ” t) is starting
0.2 x(t) and h(t ” t), and the response
of the system is not zero.
Finally, we mention that since the time in which the overlap starts (and the output is nonzero) is known, the definition of the zero parts of the two signals could have been avoided. This method will be discussed further in the discrete-time convolution section. As expected, the outcome provided by this second approach is the same.

198 Signals and Systems Laboratory with MATLAB1
Commands Results
1.4 1.2
t 1⁄4 1:.01:2; 1 x 1⁄4 ones(size(t)); 0.8 h 1⁄4 ones(size(t));
y 1⁄4 conv(x,h)*.01; 0.6 plot(2:.01:4,y) legend(‘y(t)’) 0.4
0.2
02 2.2 2.4 2.6 2.8 3 3.2 3.4 3.6 3.8 4
Example
Suppose that a system is described by the impulse response h(t) 1⁄4 cos(2pt)(u(t) ” u(t ” 4)). Compute and plot the response of the system to the input signal that is shown in the figure below.
2 1.8 1.6 1.4 1.2 1 0.8 0.6 0.4 0.2
00 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
First, the mathematical expression of the input signal x(t) must be derived. The input signal is a two-part function, where each part is a straight line. So, in order to determine the mathematical expression of the signal the straight line equation x(t) 1⁄4 at þ b is employed. To find a and b it is enough to examine the values of x(t) in two points. The straight line equation forthefirstpartisx1(t)1⁄4a1tþb1.Attheaxisorigin(i.e.,att1⁄40),weget01⁄4a10þb1 )b1 1⁄40. Attheendofthefirstpart(i.e.,att1⁄41),weget21⁄4a11þ0)a1 1⁄42.Hence,themathematical expression of the first part is x1(t) 1⁄4 2t, 0 t 1. For the second part the straight line equation is x2(t)1⁄4a2tþb2. At t1⁄41, we get 21⁄4a21þb2 ) b2 1⁄42″a2; while at t1⁄42, we get 01⁄4a22þb2 ) a2 1⁄4 b2=2. Thus, a2 1⁄4 “2, b2 1⁄4 4, and the mathematical expression of the second part is x2(t) 1⁄4 4 ” 2t, t 2. Therefore, the input signal is given by
Comments
Only the nonzero parts of x(t) and h(t) are considered in the computation. The plot of the output y(t) starts att1⁄42.
y(t)
x(t)

Time Domain System Analysis 199 x(t) 1⁄4 & 2t, 0 t 1 :
4″2t, 1 t 2
The mathematical expression of the impulse response is h(t)1⁄4cos(2pt)(u(t)”u(t”4)), which is simplified into h(t) 1⁄4 cos(2pt), 0 t 4. In order to apply the first rule (i.e., to define both signals at the proper time interval) the input signal is written as
(2t, 0t1 x(t)1⁄4 4″2t, 1: . .
8> b[0], n 1⁄4 0 <>b[1], n1⁄41
b[M], n 1⁄4 M.
Commands
x 1⁄4 [1 “1 3 zeros(1,8)];
y 1⁄4 conv(x,h);
stem(0:20,y);
axis([“1 20 “11 16]); legend(‘y[n] with use of conv’)
Results
y[n] with use of conv
15 10 5 0 −5 −10
0 2 4 6 8 10 12 14 16 18 20

234 Signals and Systems Laboratory with MATLAB1
Second way: With use of the command filter. In a similar manner to the procedure followed in the IIR filter case, the input signal x[n] is padded with the appropriate number of zeros.
Commands
x 1⁄4 [1,”1,3,zeros(1,18)];
y 1⁄4 filter(b,a,x); stem(0:20,y);
axis([“1 20 “11 16]); legend(‘y[n] with use of filter’)
The two graphs are the same, therefore we conclude that when we deal with FIR filters we can use both commands conv and filter to compute the output signal.
4.9 Stability Criterion for Discrete-Time Systems
In Section 4.5, we have established a criterion about the stability of continuous-time LTI systems. More specifically, it was stated that a system is stable if the impulse response of the system is absolutely integrable. For discrete-time systems a similar criterion can be established. More specifically, a discrete-time linear shift-invariant system is stable if and only if its impulse response h[n] is absolutely summable. The mathematical expres- sion is
X1 jh[n]j < 1: (4:19) n1⁄4"1 Example A system is described by the impulse response h[n] 1⁄4 (1=2n)u[n]. Tell if this is a BIBO stable system. Results=Comments y[n] with use of filter 15 10 5 0 −5 −10 0 2 4 6 8 10 12 14 16 18 20 Time Domain System Analysis 235 A discrete-time system is BIBO stable if the condition given in (4.19) is satisfied; that is, we examine if the impulse response of the system is absolutely summable. Commands syms n h1⁄41=(2^n) symsum(abs(h),n,0,inf) Results ans 1⁄4 2 please see the reference materials of BP Lathi for system described by D.E. and deriving impulse response Comments Condition (4.19) is fulfilled; hence, the system under consideration is BIBO stable. 4.10 Systems Described by Differential Equations In Section 4.7, we saw how a discrete-time system is described by a difference equation. Similarly, a continuous-time system can be described by a differential equation. More specifically, the input and output signals are related through a linear ordinary differential equation with constant coefficients; i.e., the input–output relationship of the system is of the form an dny(t) þ ( ( ( þ a1 dy(t) þ a0y(t) 1⁄4 bm dmx(t) þ ( ( ( þ b1 dx(t) þ b0x(t): (4:20) dtn dt dtm dt The response y(t) of the system to a given input signal x(t) is easily obtained by solving the differential equation. Recall that the MATLAB command dsolve is employed to solve ordinary differential equations. Recall also that for a given function x(t) there are many different solutions of this differential equation depending on the initial values (or initial conditions) y(0), y0(0),..., y(m"1)(0). If the initial conditions are zero, that is, y(0) 1⁄4 y0(0) 1⁄4 ( ( ( 1⁄4 y(m"1)(0) 1⁄4 0, then the system is said to be in initial rest. Example Commands f1⁄4‘Dyþy"exp("t)*heaviside(t)’ y 1⁄4 dsolve(f,‘y(0) 1⁄4 0’) Results f1⁄4Dyþy"exp("t)*heaviside(t) y 1⁄4 exp("t)*heaviside(t)*t Comments Definition of the differential equation y0(t)þy(t)1⁄4x(t), where x(t) 1⁄4 e"tu(t). (continued) Suppose that a system is described by the first-order differential equation y0(t) þ y(t) 1⁄4 x(t). Suppose also that the system has zero initial conditions; that is, y(0)1⁄40. Compute the response of the system to the input signal x(t) 1⁄4 e"tu(t). 236 Signals and Systems Laboratory with MATLAB1 (continued) Commands 0.4 0.35 0.3 0.25 ezplot(y,[0 10]) 0.2 title(‘y(t) from differential equation’) 0.15 0.1 0.05 0 Results 0 1 2 3 4 5 6 7 8 9 10 t Comments The response of the system to the input signal x(t) 1⁄4 e"tu(t) is derived by solv- ing the differential equation. The com- puted output sig- nal is y(t) 1⁄4 te"tu(t). In Chapter 11, we will learn how to derive the impulse response of a system described by a differential equation. For now, take as granted that the impulse response h(t) of the system described by the differential equation y0(t) þ y(t) 1⁄4 x(t), y(0) 1⁄4 0 is h(t) 1⁄4 e"tu(t). We confirm that the response of the system to x(t) 1⁄4 e"tu(t) is y(t) 1⁄4 te"tu(t) by convoluting the input signal with the impulse response h(t) of the system. Commands Results Comments The output y(t) of the system is computed by convoluting the input signal x(t) 1⁄4 e"tu(t) with the impulse response sig- nal h(t)1⁄4e"tu(t). The obtained graph is same as the previous one; hence, y(t) 1⁄4 te"tu(t) is indeed the output signal. 0.35 t 1⁄4 0:0.001:5; 0.3 x 1⁄4 exp("t); 0.25 h 1⁄4 exp("t); y 1⁄4 conv(x,h)*0.001; 0.2 plot(0:.001:10,y); 0.15 title(‘y(t) from convolution’) 0.1 0.05 0.4 y(t) from convolution 00 1 2 3 4 5 6 7 8 9 10 4.11 Step Response of a System A last topic that is discussed in this chapter is the step response of a system. The step response s(t) of a continuous-time system is defined as the response of the system to the unit step function u(t), and correspondingly the step response s[n] of a discrete-time system is the response of the system to the unit step sequence u[n]. y(t) from differential equation Time Domain System Analysis 237 Example Compute in the time interval 0 n 100 the step response of the system described by the difference equation y[n] 1⁄4 y[n " 1] þ 0.2x[n] þ 0.1x[n " 1]. The input x[n] 1⁄4 u[n], 0 n 100 is applied to the system and the output signal y[n] that is returned from the command filter is the step response of the system. Commands a 1⁄4 [1 "1]; b 1⁄4 [.2.1]; n 1⁄4 0:100; u 1⁄4 ones(size(n)); s 1⁄4 filter(b,a,u); stem(0:100,s); 35 30 25 20 15 10 Results Step response of the system Comments The step response of the system in the time interval 0 n 100. title(‘Step response of the system’) 5 00 10 20 30 40 50 60 70 80 90 100 The step response of a system can be also computed by the commands step and dstep in the continuous-time and discrete-time case, respectively. These two commands are dis- cussed in Chapter 11. 4.12 Solved Problems Problem1 Asystemisdescribedbytheimpulseresponseh(t)1⁄4t,0 plot the response of the system to the input signal x(t) 1⁄4 0.8t, 0 Solution Output signal y(t). 30 25 t 1⁄4 0:.01:10; h1⁄4t; 20 x1⁄40.8.^t; y 1⁄4 conv(x,h)*0.01; ty 1⁄4 0:0.01:20; plot(ty,y); legend(‘Response of the system’); 00 2 4 6 8 10 12 14 16 18 20 t 10.Computeand t 10. Response of the system 15 10 5 238 Signals and Systems Laboratory with MATLAB1 Problem 2 A system is described by the impulse response h(t) 1⁄4 e"2tu(t " 1). Compute and plot the response of the system to the input signal x(t) 1⁄4 u(t) " u(t " 2). Solution The response y(t) of the system. 0.08 0.07 0.06 y(t) t1 1⁄4 0:.1:.9; t2 1⁄4 1:.1:10; h1 1⁄4 zeros(size(t1)); h2 1⁄4 exp("2*t2); h 1⁄4 [h1 h2]; 0.05 t1 1⁄4 0:.1:2; t2 1⁄4 2.1:.1:10; x1 1⁄4 ones(size(t1)); x2 1⁄4 zeros(size(t2)); x 1⁄4 [x1 x2]; y 1⁄4 conv(x,h)*0.1; plot(0:.1:20,y); legend(‘y(t)’); 0.04 0.03 0.02 0.01 00 2 4 6 8 10 12 14 16 18 20 Problem3 Theinputsignalx(t)1⁄4u(tþ2)"u(t"3)isappliedtoasystemdescribedbythe impulse response h(t) 1⁄4 e"3tu(t). Compute and plot the output signal of the system. Solution 0.35 t1 1⁄4 "2:.1:3; 0.3 y(t) x1 1⁄4 ones(size(t1)); t2 1⁄4 3.1:.1:10; x2 1⁄4 zeros(size(t2)); x 1⁄4 [x1 x2]; 0.25 t1 1⁄4 "2:.1:0; 0.2 h1 1⁄4 zeros(size(t1)); t2 1⁄4 0.1:.1:10; h2 1⁄4 exp("3*t2); h 1⁄4 [h1 h2]; y 1⁄4 conv(x,h)*.1; plot("4:.1:20,y) legend(‘y(t)’); 0.15 0.1 0.05 0 −5 0 5 10 15 20 Time Domain System Analysis 239 Problem 4 Compute and plot the convolution between the signals that are depicted in the figure below. 1 0.8 0.6 0.4 0.2 00 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 1 0.8 0.6 0.4 0.2 00 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 Solution First the convolution is computed according to the four rules established in the continuous- time convolution section. x(t) h(t) 2 Result according to the four rules of convolution t2 1⁄4 2.01:.01:4; 1.8 t3 1⁄4 4.01:.01:5; x1 1⁄4 zeros(size(t1)); 1.6 t1 1⁄4 0:.01:2; x2 1⁄4 ones(size(t2)); x3 1⁄4 zeros(size(t3)); x 1⁄4 [x1 x2 x3]; h1 1⁄4 ones(size(t1)); h2 1⁄4 zeros(size([t2 t3])); h 1⁄4 [h1 h2]; 0.6 y 1⁄4 conv(x,h)*0.01; plot(0:0.01:10,y); title(‘Result according to the four rules of convolution’) 0.4 0.2 00 1 2 3 4 5 6 7 8 9 10 1.4 1.2 1 0.8 240 Signals and Systems Laboratory with MATLAB1 Alternatively, the convolution is computed according to the two principles introduced in the discrete-time convolution section. As it is illustrated in this problem, the two principles can also be applied successfully also to the continuous-time case. 2.5 2 1.5 1 two principles of convolution’) 0.5 Result according to the two principles of convolution t1 1⁄4 2:.01:4; x 1⁄4 ones(size(t1)); t2 1⁄4 0:.01:2; h 1⁄4 ones(size(t2)); y 1⁄4 conv(x,h)*0.01; plot(2:.01:6,y) title(‘Result according to the 02 2.5 3 3.5 4 4.5 5 5.5 6 Problem 5 A system is described by the impulse response h(t)1⁄4e"t(u(t"1)"u(t"3)). Compute and plot the response of the system to the input signal Solution x(t)1⁄4&t, 1 t 3: 1, 3