Professional Documents
Culture Documents
Feedback and Control Systems Laboratory: ECEA107L/E02/2Q2021
Feedback and Control Systems Laboratory: ECEA107L/E02/2Q2021
LABORATORY
ECEA107L/E02/2Q2021
Activity No. 1
𝑑 2 𝑐(𝑡) 𝑑𝑐(𝑡)
a. +4 + 13𝑐(𝑡) = 𝑟(𝑡)
𝑑𝑡 2 𝑑𝑡
MATLAB Commands:
>> Procedure 1 Question a
>> syms c(t);
>> roots([1,4,13])
ans =
-2.0000 + 3.0000i
-2.0000 - 3.0000i
homogeneous_solution =
C1*cos(3*t)*exp(-2*t) - C2*sin(3*t)*exp(-2*t)
𝑑 2 𝑐(𝑡) 𝑑𝑐(𝑡)
b. +8 + 16𝑐(𝑡) = 𝑟(𝑡)
𝑑𝑡 2 𝑑𝑡
MATLAB Commands:
>> %Procedure 1 Question b
>> syms c(t);
>> roots([1,8,16])
ans =
-4
-4
homogeneous_solution =
C1*exp(-4*t) + C2*t*exp(-4*t)
𝑑 2 𝑐(𝑡) 𝑑𝑐(𝑡)
c. +7 + 12𝑐(𝑡) = 𝑟(𝑡)
𝑑𝑡 2 𝑑𝑡
MATLAB Commands:
>> %Procedure 1 Question c
>> syms c(t)
>> roots([1,7,12])
ans =
-4
-3
homogeneous_solution =
C1*exp(-4*t) + C2*exp(-3*t)
5. Find the positions of the poles and zeroes of the transfer function given below
2𝑠2 + 12𝑠 + 26
𝐺(𝑠) =
𝑠3 + 4𝑠2 + 5𝑠 + 2
MATLAB Commands:
>> %Procedure 5
>> G = tf([2,12,26],[1,4,5,2])
G =
2 s^2 + 12 s + 26
---------------------
s^3 + 4 s^2 + 5 s + 2
>> pzmap(G)
Plot:
MATLAB Commands:
>> %procedure 6
>> R_s= poly([-4,-1+j,-1-j]);
>> C_s = poly([-3, -1]);
>> G = tf(C_s,R_s)
G =
s^2 + 4 s + 3
----------------------
s^3 + 6 s^2 + 10 s + 8
𝑠 2 +4𝑠+3
Transfer function, 𝐺1 (𝑠) =
𝑠 3 +6𝑠 2 +10𝑠+8
7. Solve 𝑐(𝑡) using partial fraction expansion of the system given below
𝑥(𝑠−3)
a. 𝐶(𝑠) =
𝑠(𝑠−2)(𝑠+2)
MATLAB Commands:
>> %procedure 7 Question a
>> syms c(s);
>> x = 23; %Terminal number%
>> c(s)=((x*(s-3))/((s)*(s-2)*(s+2)))
c(s) =
ans =
[1, 0, -4, 0]
a =
-2.8750 2.0000
-14.3750 -2.0000
17.2500 0
partial_fraction_expansion =
>> inverse_laplace_transform =
ilaplace(partial_fraction_expansion)
inverse_laplace_transform =
69 115 23
Partial Fraction expansion: − −
4𝑠 8(𝑠+2) 8(𝑠−2)
69 23𝑒 2𝑡 115𝑒 −2𝑡
Inverse Laplace transform: − −
4 8 8
𝑥
b. 𝐶(𝑠) = (𝑠+1)(𝑠+2)3
MATLAB Commands:
>> %Procedure 7 Question b
>> syms c(s);
>> x=23; %terminal number%
>> c(s)=(x/((s+1)*(s+2)^3))
c(s) =
ans =
a =
-23.0000 -2.0000
-23.0000 -2.0000
-23.0000 -2.0000
23.0000 -1.0000
partial_fraction_expansion =
>> inverse_laplace_transform =
ilaplace(partial_fraction_expansion)
inverse_laplace_transform =
23 23 23 23
Partial Fraction expansion: − (𝑠+2) − (𝑠+2)2 − (𝑠+2)3
(𝑠+1)
23𝑡 2 𝑒 −2𝑡
Inverse Laplace transform: 23𝑒 −𝑡 − 23𝑒 −2𝑡 − 23𝑡𝑒 −2𝑡 −
2
𝑥𝑠 3
c. 𝐶(𝑠) =
𝑠(𝑠 2 +9)(𝑠−2)2
MATLAB Commands:
>> %Procedure 7 Question c
>> syms c(s);
>> x=23; %Terminal number%
>> c(s)=((x*s^3)/((s)*(s^2+9)*(s-2)^2))
c(s) =
ans =
a =
partial_fraction_expansion =
>> inverse_laplace_transform =
rewrite(ilaplace(partial_fraction_expansion),'sincos')
inverse_laplace_transform =
𝑥(𝑠−3)
a. 𝐶(𝑠) =
𝑠(𝑠−2)(𝑠+2)
MATLAB Commands:
>> %Procedure 8 Question a
>> syms c(s);
>> x = 23; %Terminal number%
>> c(s)=((x*(s-3))/((s)*(s-2)*(s+2)))
c(s) =
inverse_laplace =
MATLAB Commands:
>> %Procedure 8 Question b
>> syms c(s);
>> x = 23; %Terminal number*
>> c(s)=(x/((s+1)*(s+2)^3))
c(s) =
inverse_laplace =
MATLAB Commands:
>> %Procedure 8 Question c
>> syms c(s);
>> x=23; %Terminal number%
>> c(s)=((23*s^3)/((s)*(s^2+9)*(s-2)^2))
c(s) =
inverse_laplace =
𝑥𝑠+1
a. 𝐶 (𝑠) = 𝑠 2 −𝑠−2 x = 23 (Terminal Number)
MATLAB Commands:
>>format short
>> syms c(s) c(t);
>>x=23;
>> c(s) = (x*s+1)/(s^2-s-2);
>> num = [x 1];
>>den = [1 -1 -2];
>>[r,p,k]=residue(num,den);
>> a = [r,p,k];
>> c(s) = (a(1,1)/(s-a(1,2)))+(a(2,1)/(s-a(2,2)))
>>c(t) = ilaplace(c(s))
c(s) =
c(t) =
(22*exp(-t))/3 + (47*exp(2*t))/3
MATLAB Commands:
>> format short
>>syms c(s) c(t);
>> x=23;
>> c(s) = (x*s+3)/(2*s^3-3.4*s^2-1.98*s-0.406);
>> num = [x 3];
>> den = [2 -3.4 -1.98 -0.406];
>> [r,p,k] = residue(num,den);
>> a = [r,p,k];
>> ans_2 = vpa(ilaplace(c(s)),3)
>>c(s)=vpa((a(1,1)/(s-a(1,2)))+(a(2,1)/(s-a(2,2)))+(a(3,1)/(s-
a(3,2))),3)
>> c(t) = ilaplace(c(s));
>> ans_1=vpa(c(t),3) %Complex Exponential form
>> ans_2 %Trigonometric Exponential form
c(s) =
(4.4642/(s-2.1935))+((-2.2321+1.7033i)/(s+0.2468-0.1779i))+((-
2.2321+1.7033i)/(s+0.2468+0.1779i))
ans_1 =
ans_2 =
𝑥𝑠+1
c. 𝐶 (𝑠) = 𝑠 3 +5𝑠 2+8𝑠+4 x = 23 (Terminal Number)
MATLAB Commands:
>>format short;
>>syms c(s) c(t);
>>x=23;
>>c(s) = (x*s+3)/(s^3+5*s^2+8*s+4);
>>num = [x 3];
>>den = [1 5 8 4];
>>[r,p,k] = residue(num,den);
>>a = [r,p,k];
>>c(s)=(a(1,1)/(s-a(1,2)))+(a(2,1)/(s-a(2,2))^2)+(a(3,1)/(s-
a(3,2)))
>>vpa(ilaplace(c(s)),3)
c(s) =
ans =
MATLAB command:
>>format rat;
>>syms i(t) I(s) Vc(s) F;
>>x = 23; %Terminal number%
>>di = diff(i);
>>ode = (25*i + (x*(10^-3))*di+(1/(x*(10^-6)))*int(i,0,inf))==24
>>laplace_equation = laplace(ode,t,s);
>>laplace_equation=
subs(laplace(ode,t,s),laplace(int(i,0,inf)),laplace(i(t),t,s)/s)
;
>>laplace_equation = subs(laplace_equation,laplace(i(t),t,s),F);
>>laplace_equation = subs(laplace_equation,i(0),0);
>>I(s) = solve(laplace_equation,F);
>>Z(s) = 1/(s*23*10^-6);
>>Vc(s)= I(s)*Z(s)
>>vc(t)=ilaplace(Vc(s));
>>V_c =vpa(vc(t), 7)
>>fplot(V_c)
>>xlim([0 0.01])
>>ylim([0 35])
>>title('OUTPUT VOLTAGE ACROSS Vc')
>>xlabel('Time, (t) (sec)')
>>ylabel('Vc(t)')
ode(t) =
25*i(t) + (23*diff(i(t), t))/1000 + (1493901668173913*int(i(t), t,
0, Inf))/34359738368 == 24
Vc(s) =
24000000/(23*s^2*((23*s)/1000 + 1493901668173913/(34359738368*s) +
25))
V_c =
24.0 - 24.0*exp(-543.4783*t)*(cos(1262.929*t) +
0.4303315*sin(1262.929*t))
HANDWRITTEN SOLUTION FOR SEATWORK
INTERPRETATION / ANALYSIS
As it was noted from the experiment, a class of differential equation of the form
𝑑𝑖 𝑐(𝑡)
∑𝑣𝑖=0 𝑏𝑖 = 𝑟(𝑡) is called linear differential equation with constant coefficients. Linear
𝑑𝑡 𝑖
Constant-Coefficient Differential Equations (LCCDE) can describe systems called Linear
Time Invariant (LTI) Systems. Linear Time Invariant (LTI) systems means that when an
input to a given system is scaled by a value, the output of the system is scaled by the
same amount. As it was learned, solutions to an LCCDE are divided into two parts which
is the homogenous solution 𝑐ℎ (𝑡) (also known as natural response) and particular solution
𝑐𝑝 (𝑡) (also known as the forced response or steady state response). The sum of these
solutions is called the total solution of the system denoted by 𝑐(𝑡) where 𝑐(𝑡) = 𝑐ℎ (𝑡) +
𝑐𝑝 (𝑡). For procedure 1, question a, b, and c only have homogeneous solutions since the
forcing (input) function is set to zero. For question a, the auxiliary equation has imaginary
roots. For question b and c, the auxiliary equation has distinct roots. By using the
ROOTS(C) command of MATLAB, it computes the roots of the polynomial whose
coefficients are the elements of the vector C.
For procedure 2, question a, b, and c have particular solutions since there is a
forcing (input) function. Furthermore, they are considered as nonhomogeneous equation.
Simply by using direct observation of the form 𝑟(𝑡), it only means that the particular
solution 𝑐𝑝 (𝑡) will only follow whatever is the form of 𝑟(𝑡). For question a, the form of 𝑟(𝑡)
is in the form of a second-degree polynomial therefore the particular solution obtained
followed this form. For question b, it was observed that 𝑟(𝑡) is in the form of exponential
equation therefore the assumption that has been made for particular solution is that it also
an exponential. For question c, it was observed that r(t) is a trigonometric function,
therefore the possible particular solution is in the form of combination sin and cos. It also
assumes that the output would probably oscillate.
For procedure 3, the question required to find the total solution of the given
nonhomogeneous equation and all the initial conditions are set to zero. Homogeneous
solution was obtained by finding the roots of the auxiliary equation and writing the
homogeneous whether the root is distinct, repeated, or complex but for the given question
the roots of the auxiliary equation is distinct therefore the homogeneous solution is in the
form exponential. The homogeneous solution obtained only describes that the function
decays as time approaches infinity. For the particular solution of the question, it was
observed that the form of the forcing (input) function is a polynomial with a degree of 2
therefore it is assumed that the possible form of a particular solution is a second-degree
polynomial. By differentiating the assumed particular solution, it was differentiated up to
the second degree because the question is a second-degree nonhomogeneous equation
and by comparing coefficients and by using some technique to solve system of linear
equation, the constants for the particular solution was obtained. The constant for the
homogeneous solution was obtained by using the initial conditions which are all zero. The
constants for the homogeneous solution were obtained by also using some technique to
solve system of linear equations in which the total solution was evaluated at initial
conditions.
For procedure 4, the question required to find the total solution of the given
nonhomogeneous equation using Laplace transform method where the initial conditions
are assumed zero. To recap, Laplace transform which is also called as integral transforms
is an effective way to solve linear differential equation with constant coefficients having
initial conditions. The time domain differential equation will be transformed into s-domain
where the initial conditions were applied and by using inverse Laplace transform to
transform back the s-domain expression into time domain. 𝐶(𝑠) refers to the output while
𝑅(𝑠) refers to the input. By manipulating the transformed differential equation to isolate
𝐶(𝑠) , it was transformed back to the time domain after doing partial fraction
decomposition. As it was observed, the total solution obtained using the Laplace
transform method is the same for the total solution obtained using classical method of
solving nonhomogeneous differential equation.
For procedure 5, given the transfer function, it is required to find the position of the
poles and zeroes. To recap, zeroes of a transfer function refers to the value of S that
makes the numerator of the transfer function equals to zero meaning that the transfer
function vanishes, that is lim 𝐺 (𝑠) = 0. Meanwhile, poles of a transfer function refers to
𝑠→𝑧𝑖
the value of S that makes that makes the value of the transfer function becomes
unbounded, that is lim 𝐺 (𝑠) = ∞. By using the command PZMAP(SYS) it computes the
𝑠→𝑝𝑖
poles and zeros of the LTI model SYS and plots them in the complex plane. It was noted
that the poles are plotted as x’s and the zeros are plotted as o’s. Based from the given in
the question, the zeros appear to be -3-2i and -3+2i while the poles appear to be -2 and
-1.
For procedure 6, given the position of the poles and zeroes of a system, it is
required to generate the transfer function of the system. In order to solve the required
transfer function, the command POLY(A) was used to convert roots to polynomial where
A is a row vector consisting of the roots and the command used after is tf(NUM,DEN)
where it generates the transfer function based from the given numerator and denominator
𝑠 2 +4𝑠+3
expression. The obtained result appears to be 𝐺 (𝑠) = 𝑠 3+6𝑠2 +10𝑠+8.
For procedure 7, it is required to solve 𝑐(𝑡) using partial fraction expansion of the
system given. The problem was solved using the residue command in MATLAB where it
finds the residues, poles and direct term of a partial fraction expansion of the ration of two
polynomials. After the finding the partial fraction expansion, the inverse laplace transform
will be determined for the given partial fraction expansion. For question a, the
denominator has only linear factors. For question b, the denominator has linear and
repeated factors. For question c, the denominator has a linear, repeated, and quadratic
factor where the roots are complex. The given problems are tedious to do in manually
and it is more convenient to use MATLAB to generate faster and correct results especially
when doing partial fraction expansion to find the coefficients.
For procedure 8, it is required to use the ilaplace command to verify answer to
procedure 7. To recap, using the command ILAPLACE(L) calculates the inverse Laplace
transform of the scalar system L with default independent variable s. Based on the results,
by using ilaplace command it is more convenient to use since it directly calculates the
inverse laplace transform of a given system without doing partial fraction expansion and
calculation the inverse laplace transform manually. It is verified that the results obtained
from procedure 7 is the same result obtained from procedure 8 using the ilaplace
command.
CONCLUSION
To wrap up, it was determined that a linear constant-coefficient differential
equation (LCCDE) can be solve using direct method or by Laplace transform method with
the aid of MATLAB to make the computation more convenient and correct. It was
identified that a LCCDE describes a class of system that is called Linear Time Invariant
(LTI) systems meaning that when an input to a given system is scaled by a value, the
output of the system is scaled by the same amount. Moreover, the solution to LCCDE
consist of homogeneous solution and particular solution and their sum is called the total
solution of the LCCDE. The homogeneous solution also refers to the natural response
and the particular solution also refers to the forced response. Homogeneous solution is
the solution of the differential where 𝑟(𝑡) is equal to zero meanwhile particular solution is
the solution obtained by direct observation of the form of the 𝑟(𝑡) meaning that the
particular solution will just follow whatever is the form of 𝑟(𝑡). It was learned that by using
the command ROOTS can easily determine the roots of the auxiliary equation in which it
makes it more convenient to determine the homogeneous solution of the given LCCDE.
By using Laplace transform method, solving LCCDE can be more convenient especially
if there are initial conditions to consider. The Laplace transform of the independent
variable can be isolated to one side of the transformed equation and by using partial
fraction expansion and table of Laplace transforms, the inverse Laplace transform of a
function in s-domain can be easily obtained. By using the command RESIDUE, it finds
the partial fraction expansion of the ration of two polynomials and by using ILAPLACE
command, it finds the inverse Laplace transform of a given function in s domain. Moving
on, it was learned that the transfer function is the ratio of the transform of the output 𝐶(𝑠)
to the transform input 𝑅(𝑠) taking all initial conditions to be equal to zero. Zeroes of a
transfer function refers to the roots of s in the numerator that can make 𝐺 (𝑠) = 0.
Meanwhile, poles refer to the roots of s in the denominator that can make 𝐺 (𝑠) = ∞.
Lastly, by using PZMAP command it computes the poles and zeros of the LTI model and
plots them in the complex plane and the poles are plotted as x’s and the zeros are plotted
as o’s.