You are on page 1of 8

Práctica 3

Repaso de sistemas LTI A Jueves 5:00pm Brigada 427 / 437 Fecha: 04/03/2021
De León Durand Humberto 1799582
Balderas Aguilar Pedro Antonio 1877454
Davalos Ayala Leonardo 1938299
Juárez Monroy Miguel Antonio 1943563

Abstract— On this document it will be find the resolutions of


some problems for review for LTI Systems using the MATLAB
program, considering the theory seen in class about those systems.

Keywords— LTI Systems, Zeros, Poles, Transfer Function, gain,


stability, MATLAB.

Figure 1 Dynamic system for Exercise 1


I. INTRODUCTION
LTI Systems (linear time invariant systems) were seen The sum of the forces is equal to F(t), in this problem we have
during previous classes to be described as systems which three different forces: Inertial force (𝑚𝑥̈ ), Damper force (𝑐𝑥̇ )
generate signal output from all the input signals subject to and spring force (kx) acting on the system.
linearity and time invariance constraints. This implies that, if a
system is linear, the output of the system is scaled by the same Thus, the resulting equation is shown in (1)
value if an input is set to a given system. [1]
To interpret the behavior, a transfer function that is the 𝐹(𝑡) = 2𝑥̈ + 𝑥̇ + 10𝑥 (1)
relationship between the control system output signal and the
input signal must be applied to all potential input values. A As F(t) is the input we do not substitute in the above equation
reference input known as stimulation or that it acts through a (due is a variable) and each point is equivalent to one “s”.
transfer function to generate an effect that results in regulated
output or reaction exists for any control system. [2] Then we calculate the transfer function, as the initial
The obtention of the transfer function makes easier the conditions are not given, we assume that are zero (the system
interpretation of the behavior of LTI Systems, but to get a starts to move so position and velocity are 0 at the beginning).
complete interpretation of the results, there is necessary to obtain
the information of the poles, the zeros, and the gain through the From Laplace transform class we know that the formula
manipulation of the transfer function. (shown in (2)) for Laplace transform applied to differential
equations is:
For those reasons, there is an easier way to obtain of that data
and is through the use of program tools as MATLAB. MATLAB ℒ{𝑦 𝑛 (𝑡)} = 𝑆 𝑛 𝑋(𝑆) − 𝑆 𝑛−1 𝑋(0) − ⋯ − 𝑆𝑋 𝑛−2 (0) − 𝑋 𝑛−1 (0) (2)
through commands as “tf(num,den)” for the obtention of a
transfer function and then the use of “pole()”, “zero()” or Substituting (2) in (1) applying Laplace transform:
“dcgain()” commands makes easier for us that data
interpretation and calculation. 𝐹(𝑆) = 2[𝑆 2 𝑋(𝑆) − 𝑆𝑋(0) − 𝑋̇(0)] + 1[𝑆𝑋(𝑆) − 𝑋(0)] + 10𝑋(𝑆) (3)

Initial conditions are zeros, so the resulting equation is found


II. EXERCISE 1 in (4).
For the first exercise, it is asked to simulate the system
shown in Figure 1, the problem gives the next data: 𝐹(𝑆) = 2𝑆 2 𝑋(𝑆) + 𝑆𝑋(𝑆) + 10𝑥(𝑆) (4)

• k = 10 N/m Then the transfer function for the system is


• C = 1 N/(m/s)
𝑋(𝑆) 1
• m = 2 kg 𝐹(𝑆)
=
2𝑆 2 +𝑆+10
(5)
• F(t) = 1 N
The code in Figure 2 starts on the first 2 lines with commands
“clear” and “clc”, both are used for erasing all past values
obtained in last programs that were run in MATLAB and then
erase the MATLAB screen.
figure out the others results that the problem asks. The next line
of code gives the polos as an output, Figure 5 shows the results.

Figure 5 Polos for the transfer function

It is important to remark that we are interested in the second


output, that is because the negative number of the imaginary
part changes the sign when is passed to the transfer function.

Then, zero command gives the zeros of the transfer function


as shown in Figure 6.

Figure 2 Code for exercise 1

The next two lines of code indicates the numerator (num)


and denominator (den) of the transfer function; MATLAB takes
Figure 6 Zeros of the transfer function
as an input these values and with the pre-defined function “tf”
outputs the transfer function, next we call “step” that is to make
“Isstable” is a Boolean command, it outputs whether a
a step graph (Figure 3) of the transfer function.
transfer function is stable with a logical true (1) or not with a
logical false (0) [3], the Figure 7 shows the output.

Figure 7 Isstable output

The next command returns the stationary-state gain, the


command called “dcgain” receives the dynamic system as its
transfer function and computes DC gain of the LTI model [4]
Figure 3 Graph for X(S)/F(S)
as shown in Figure 8.
The next command of code is a very useful command, gives
us the information of the function by just passing the transfer
function, the results are shown in Figure 4.

Figure 8 DC gain for the model

Finally, we have “damp” command, this function (in this


case) returns the damping ratios as the first variable and the
natural frequencies as the second variable, Figure 9 shows the
output.

Figure 4 Information given by info() command.


The above image shows the output results, the ones that is
for or interest are Settling Time and Overshoot, next we must
Figure 13 Direct term

Then we created a t vector, this is going to act as a variable


that simulate the time and finally, we plot the resultant graph,
the parameters that are in the plot command was given by the
instructor.
Figure 9 Damping ratios and natural frequencies.
Figure 13 shows in red, the result of that plotting meanwhile
Thus, we have made all calculation asked by the problem. Figure 14 shows the last graph (graph generated with step
Next, we must calculate the step response to the system command), we are presenting graph separated because in just
analytically. Figure 10 shows the code for this part. one figure was unable to watch them.

Figure 10 Code for analytical response

Residue finds the residues, poles, and direct term of a Partial


Fraction Expansion of the ratio of two polynomials [5], the first
polynomial is for numerator and the second polynomial is for
denominator, the results are shown in Figure 11 for residues,
Figure 12 for poles and Figure 13 for the direct term.
Figure 14 Graph using plot.

Figure 11 Residues Figure 15 Graph using step()

Both graphs are the same but the way that were made was
different.
III. EXERCISE 2
For second exercise, there are shown some resonance of
harmonic oscillation systems and there is asked to generate
simulations considering the following inputs shown in (6), (7)
and (8) and explain its behavior what about F (t).

𝐹 (𝑡) 𝑖𝑛(0.1 𝑑 ) 1 = 𝑠 ∗ 𝑤 ∗ 𝑡 (6)

Figure 12 Poles 𝐹 (𝑡) 𝑖𝑛(𝑤𝑑 ) 2 = 𝑠 ∗ 𝑡 (7)

𝐹 (𝑡) 𝑖𝑛(10 𝑑 ) 3 = 𝑠 ∗ 𝑤 ∗ 𝑡 (8)


In figure 18, for the second input shown in (7), there is
described the code that this input will follow for an interval of
time of “t=0:0.01:35;”, then the numerator is described by
command “num=1;” and the denominator for command “den=
[2 1 10];”. Those values are stored in command
“G=tf(num,den);” for the transfer function. Then the input
value command is written by command “input2=sin(02.22*t);”
and finally by the use command “lsim(G,input2,t);”

The wave to oscillate at the frequency of damped


Figure 16 Code for F (t) in(0.1 d ) 1 = s * w * t oscillation, you can see that very quickly it reaches steady state
and oscillate quite fast. (Fig 17)
For input one shown in (6), in figure 16, there is described
the code that this input will follow for an interval of time of
“t=0:0.1:100”, then the numerator is described by command
“num=1;” and the denominator for command “den= [2 1 10];”.
Those values are stored in command “G=tf(num,den);” for the
transfer function. Then the input value command is written by
command “input1=sin(0.1*2.22*t);” and finally by the use
command “lsim(G,input1,t);”

There is use the transfer function from the previous exercise


and where it is given the input of the tenth of the oscillation
frequency muffled. The amplitude is not very extensive and
does not move very fast, as there is shown in Figure 17.

Figure 19 Graph for F (t) in(wd ) 2 = s * t

Figure 20 Code for F (t) in(10 d ) 3 = s * w * t

Figure 17 Graph for F (t) in(0.1 d ) 1 = s * w * t


For the last input (8) on this exercise, the input of ten times
the frequency is given muffled. The blue line position hardly
rises from its oscillations are fast as the interval of time is
defined as “t=0:0.001:35;”, then the numerator is described by
command “num=1;” and the denominator for command “den=
[2 1 10];”. Those values are stored in command
“G=tf(num,den);” for the transfer function. Then the input
value command is written by command
“input3=sin(10*2.22*t);” and finally by the use command
“lsim(G,input3,t);”
Figure 18 Code for F (t) in(wd ) 2 = s * t
For each case, the behavior corresponds well to the diagram IV. EXERCISE 3
of the system, before the frequency of cut amplitude is small
and oscillates slowly. For the cutoff frequency you can see the The last exercise asks to analyze the following system:
influence of the resonance peak at which the amplitude
increases quite a bit compared to other frequencies and it does
quickly. Finally, after the cutoff frequency, see how even if it
moves faster than amplitude is quite small that hardly moves
even though it is oscillating quickly as is shown in figure 21
and figure 22.

Figure 23. Mass-spring system exercise 3

It is necessary to obtain the transfer function of x1 and x2


with respect to the input force F so afterwards the poles, zeros
and the response to step and sine input can be calculated for
each transfer function. This is relatively easy to do in
MATLAB as there already commands that can calculate these
things, however first the transfer functions must be solved for
from the equations given.

To begin with, the Laplace transform of each equation must


be obtained:

𝐹(𝑠) = 𝑠 2 𝑚1 𝑋1 (𝑠) + 𝑘𝑋1 (𝑠) − 𝑘𝑋2 (𝑠) (9)

Figure 21 Graph for F (t) in(10 d ) 3 = s * w * t 𝑘𝑋1 (𝑠) − 𝑘𝑋2 (𝑠) = 𝑠 2 𝑚2 𝑋2 (𝑠) (10)

From (10) it is possible to solve for X2(s) as is shown in (11)


and that way obtain the transfer function (13) of X1 from (9) by
obtaining (12)

𝑘𝑋1 (𝑠)
𝑚2 𝑠2 +𝑘
= 𝑋2 (𝑠) (11)

𝑘𝑋1 (𝑠)
𝐹(𝑠) = 𝑠 2 𝑚1 𝑋1 (𝑠) + 𝑘𝑋1 (𝑠) − 𝑘(𝑚 2 ) (12)
2 𝑠 +𝑘

𝑋1 (𝑠) 1
𝐹(𝑠)
= 𝑘2
(13)
𝑚1 𝑠2 +𝑘−
𝑚2 𝑠2 +𝑘

(13) can be simplified by multiplying by 𝑚2 𝑠 2 + 𝑘, which


leaves (14).

𝑋1 (𝑠) 1
= 𝑠4 (𝑚 2
(14)
𝐹(𝑠) 1 𝑚2 )+𝑠 (𝑘(𝑚1 +𝑚2 ))

Figure 22 Amplification Graph for F (t) in(10 d ) 3 = s * w * t A relation between x1 and x2 can also be obtained and shown
in (15).

𝑘 𝑋 (𝑠)
= 𝑋2(𝑠) (15)
𝑚2 𝑠2 +𝑘 1
that will be used to evaluate a sine input, arbitrary values are
This way the transfer function for x2 can be calculated by given to both masses and the spring constant, since the exercise
considering relation shown in (16). did not mention any specific values. Then, letters from A to E
were given the values of the denominator’s coefficients, this is
𝑋1 (𝑠) 𝑋2 (𝑠) 𝑋2 (𝑠) a little redundant but since both transfer functions share the
(𝑠)
= (16) same denominator it seemed like a practical way to correct both
𝐹(𝑠) 𝑋1 𝐹(𝑠)
if necessary. These variables go from the coefficient of the
Substituting (14) and (15) in (16), there is obtained (17) highest order variable to the constants, that is why only A and
C have values, as they belong to 𝑠 4 and 𝑠 2 .
𝑋2 (𝑠) 1 𝑘 Once these variables were defined it is possible to name the
= 𝑘2
(17) systems, Gx1 is used to name the transfer function of x1 with
𝐹(𝑠) 𝑚1 𝑠2 +𝑘− 𝑚2 𝑠2 +𝑘
𝑚2 𝑠2 +𝑘 respect to the input force, the command “tf” is used to specify
Simplifying (17), there is obtained (18). that it is a transfer function, this command allows to use a
notation for the numerator and denominator coefficients, the
𝑋2 (𝑠) 1 𝑘 functions were printed as shown next:
= 2 2+𝑘
𝐹(𝑠) 𝑘 𝑚 2 𝑠
𝑚1 𝑠 2 + 𝑘 −
𝑚2 𝑠 2 + 𝑘

𝑋2 (𝑠) 𝑘
= 𝑠4 (𝑚 2
(18)
𝐹(𝑠) 1 𝑚2 )+𝑠 (𝑘(𝑚1 +𝑚2 ))

Having both transfer functions it is possible to write a code to


calculate the desired parameters:

Figure 25. Transfer function for x1.

Figure 26. Transfer function for x2.

The analysis of x2 transfer function is basically the same,


except that the transfer function has k in its numerator. Then the
response to the step input is used with the command “step”,
which just asks for the system to analyze and up to which time
it must be analyzed (10 seconds were set arbitrarily). To study
the sine input the “lsim” (linear simulation) command was used
[6], which allows to type in almost any type of input. This
command needs to know the system to analyze, the input and
the time up to which it will analyze, naturally the last two
vectors must be the same size.

Figure 24. Code for exercise 3.

The code starts by clearing the screen and saved results as


usual, then some variables are defined: t is a variable for time
Figure 30. Linear Simulation Response to input of Gx1
Figure 27 Step Response to input of Gx1
Finally, the commands “pole” and “zero” were used to know
the zeros and poles of the transfer function. These commands
just need to know the name of the system to analyze.

Figure 31. Poles and zeros of Gx1

Figure 28. Linear Simulation Response to input of Gx1

Figure 32. Poles and zeros of Gx1

Since both transfer functions have the same denominator, it is


logical that they share the same poles, the result for zeros shows
“ox1 empty double column vector” because both tf have no
zeros, since their numerators are constants.

Figure 29 Step Response to input of Gx2


V. CONCLUSIONS D. 1943563 Miguel Antonio Juarez Monroy

This practice was to understand the MATLAB’s commands


A. 1799582 Humberto De León Durand to solve transfer functions, is much easier with the help of
MATLAB rather than doing by ourselves. There are different
In this work we had the opportunity to practice basic ways to find the solution as seen in the first exercise, commands
commands related to writing transfer functions and analyzing like step and step info short the amount of time spending either
their properties through specific commands, which surprisingly coding or solving by hand this kind of problems.
exist for a lot of things, these commands can help analyze Also was useful to remember what we learned in dynamics
properties of the system or even study their response to specific systems the last semester but in an easier way using MATLAB,
inputs etc. I got stuck in some commands because I did not know how to
Although we are familiar with most of the topics reviewed use them but with the help support that the software has helped
in this work it always comes in useful to practice coding and to me to finish the practice.
remember specific commands that sometimes are easy to forget
but very useful to use in specific situations. To be honest it took
me some time to remember what I knew about transfer VI. REFERENCES
functions and even more about MATLAB syntaxis, but a little
reading did the trick. [1] J. Thanos Antoulas, «2.2 Linear Time Invariant
Systems,» [Online]. Available:
B. 1877454 Pedro Antonio Balderas Aguilar https://cnx.org/contents/d2CEAGW5@15.4:8WV3AEH
As a conclusion, I might conclude that it is a good opportunity y@27/Linear-Time-Invariant-Systems. [Último acceso:
for the study and understanding of LTI systems using transfer 03 March 2021].
functions through the MATLAB software. Through the [2] Electrical4U, «Transfer Function of Control System,» 22
resolution of these problems and the use of various commands, October 2020. [Online]. Available:
I found that there are multiple ways to find the solution as seen https://www.electrical4u.com/transfer-function/.
in the different exercises, commands such as step and step [Último acceso: 03 March 2021].
information, which reduce the time needed either to code or [3] MATLAB, «Isstable,» [Online]. Available:
solve problems by hand. https://la.mathworks.com/help/control/ref/lti.isstable.ht
During we were doing this practice, I found with some ml?searchHighlight=isstable&s_tid=srchtitle.
difficulties with some commands that were unknown for me, [4] MATLAB, «dcgain,» [Online]. Available:
but with some investigation I got them in a more efficient way. https://la.mathworks.com/help/control/ref/dcgain.html?s
C. 1938299 Leonardo Davalos Ayala earchHighlight=dcgain&s_tid=srchtitle.
In practice, different types of information from the transfer [5] MATLAB, «Residue,» [Online]. Available:
functions of dynamic system. It is useful that there are https://la.mathworks.com/help/matlab/ref/residue.html.
commands that easily provide it to us as the zeros and poles, [6] Mathworks, «lsim,» 2020. [Online]. Available:
together with the decomposition into partial fractions. For the https://la.mathworks.com/help/control/ref/lti.lsim.html;j
second exercise, it is important to note that the functionality of sessionid=b009337dd42caf68beb513b9cbb2.
the bode diagram where the amplitudes correspond to the
change in profit with respect to cutoff frequency.

You might also like