Assignment 02 Solutions
Assignment 02 Solutions
Department of Electrical and Computer Engineering Fredericton, NB, E3B 5A3 Canada
A mechanical system is given in Fig. Q1, where y, k, m and B are the position of the mass, the springs constant, the mass, and the friction coefficient, respectively. The initial conditions are y(0)=0 and y(1)(0)=2, where y(1)(0) is the term that appears in Laplace transform of a second order differential equation as s2Y(s)sy(0)-y(1)(0) when the initial conditions are considered. Assume that the applied force f(t)=u(t) is a unit step function.
a. b.
Fig. Q1.
Write differential equation for this system. Assume f(t) and y(t) as input and output, respectively and obtain the transfer function with all initial conditions are zero. c. Let m=1, B=3 and k=2, and determine the response y(t) using inverse Laplace transform. d. Develop a Matlab/Simulink simulation block diagram model for this system and simulate it. e. Compare the results from (c) and (d). Assume that B is the total friction constant from both sides.
d2y dy = f (t ) ky B 2 dt dt
PS: 1. If the gravity effect mg is included, then the total force becomes fT(t)=f(t)+mg 2. If B1 and B2 is used instead of B, then B=B1+B2
(b). Transfer Function (with zero initial conditions ) s 2Y ( s ) sy (0) y (1) (0) = F ( s ) kY ( s ) B [ sY ( s ) y (0) ]
(s
Y ( s) =
Y ( s) 1 = 2 F ( s ) s + sB + k
Y (s) =
F (s) Mg ( s ) + 2 s + sB + k s + sB + k
2
(c). The response of y(t) using inverse Laplace transform for m=1, B=3 and k=2, and f(t)=u(t)=1.
Y ( s) = F ( s) By (0) + sy (0) + y (1) (0) + s 2 + sB + k s 2 + sB + k
Y (s) =
(s
+ 3s + 2
s s + 3s + 2
2
Y (s) =
(s
0+2+0
2
+ 3s + 2
) s (s
1
2
+ 3s + 2
Y (s) =
(s
2
2
+ 3s + 2
) s (s
1
2
+ 3s + 2
2 2 1 2 1 12 2 1 or Y ( s ) = + s +1 s + 2 + s s +1 + s + 2 ( s + 1)( s + 2) s ( s + 1)( s + 2)
Then,
1 1 y (t ) = 2et 2e 2t + e t + e 2t 2 2
y (t ) =
1 t 3 2 t +e e 2 2
% Assignment 2 % Answer 1 clear; clf % -------------------t=0:0.1:10; y1=1/2; y2=exp(-t)-(3/2)*exp(-2*t); y=y1+y2; plot(t,y) xlabel('Time (sec.)') ylabel('y') grid
PS:
1. If the gravity effect mg is included, then the total force becomes fT(t)=f(t)+mg=1+9.8=10.8 2. If B1 and B2 is used instead of B, then B=B1+B2=3+3=6.
The shape of the response does not change. However the graph may be shifted up.
Y ( s ) s 2 + sB + k = F ( s) + y (1) (0)
s 2Y ( s ) + sBY ( s ) + kY ( s ) = F ( s ) + y (1) (0) s 2Y ( s) = sBY ( s ) kY ( s ) + F ( s) + y (1) (0)
Caution:
It should not be forgotten that the initial condition is present only at the beginning of the simulation. After the first sampling, it is replaced by the new values of y(t). Therefore after the first sampling, the input signal for y(0) should be zero. Therefore a step input with initial value 2 and final value 0 after 1 sec is used to represent y(0). Do not forget that there may be many different types block diagrams to represent the same system. The shape of the block diagram may be different but the resultant graph should be the same or similar.
Question 2.
An RLC circuit is given in Fig. Q2. The capacitor C is initially charged at 10 V and the switch S closes at t=0. The other circuit parameters are; L=5 H and the resistor R=20 Ohm, and C=0.05 F. Assume VC as input and VR as the output.
a. b. c.
Fig. Q2.
Write differential equation for this circuit. Obtain the current I(s) and voltage VR(s) in s-domain. Obtain analytical solutions for i(t) and vR(t) using inverse Laplace transform and plot it for 10 seconds. d. Develop a Matlab/Simulink block diagram model and simulate the system. e. Compare the results from (c) and (d).
Solution 2.
(a). Differential equation
Applying Kirchhoffs voltage law:
di 1 + Ri + idt = 0 dt C
di 1 = Ri idt dt C
I ( s) =
( s + 2 )2
i (t ) = 2te 2t
vR (t ) = 40te 2t V.
(d). Matlab/Simulink block diagram model Using the equation obtained in part (b).
20 10 5s + 20 + s I ( s ) = + s
5sI ( s ) =
10 20 20 I ( s ) s s
Caution:
It should not be forgotten that the initial condition is present only at the beginning of the simulation. After the first sampling, it is replaced by the new values of vc(t). Initial condition may be treated as in the first question. Or you may come up with a different block that compensates the initial condition in time. Do not forget that there may be many different types block diagrams to represent the same system. The shape of the block diagram may be different but the resultant graph should be the same or similar.
Question 3
R2 C2 Vo
An OP-AMP circuit is given in the Fig. Q3. a. Obtain the transfer function of this circuit as Vi is the input and V0 is the output. Assume that the transfer function is in the form of Vo ( s ) a s 2 + a1s + 1 = 2 Vi ( s ) b1s Obtain parameters a2, a1 and b1 in terms of R1, R2, C1 and C2.
Vi C1
+
Fig. Q3.
Solution 3:
Zi = R1 1 = + C1s 1 + R1C1s
1 R1
Z f = R2 +
R C s +1 1 = 2 2 C2 s C2 s
I - =0
V+ =V- =0
a 2 =R 1R 2 C1C a1 =R 1C1 +R 2 C 2 b1 = R 1C 2