You are on page 1of 8

Práctica 4

Control Matlab A Miércoles 5:50 pm 437 30/03/2023


Martínez Valero Antonio 1957324
Valle Franco Jorge Augusto 2077447
Vargas Moya Gabriel Jerome 2077615
Abstract— This electronic document provides the resolution ω Ia
of a DC motor LTI system and the obtention of the transfer Where will be taken as Gm and as Ga.
function with symbolical and numerical methods. Te Va−ω Kt
It us recommended to employ the following variable
Keywords—Symbolic, MATLAB, transfer function, LTI, substitution:
systems, problems.

I. THERORETICAL FRAMEWORK
Fig 2. Recommended variable substitution
Control systems play an essential role in modern engineering
and technology, allowing for the precise regulation and control
B. Procedure and observations
of physical processes. Matlab is a powerful software tool
widely used for the design and analysis of control systems, Firstly, we must obtain Laplace transform of the equation
offering a variety of built-in functions and toolboxes that system, thus having
facilitate the modeling and simulation of complex systems.

One of the key features of Matlab is the ability to represent


control systems using symbolic transfer functions. Symbolic
s I a= (
1 Va
La s )
−ω K t −I a R a =0 (1)

(2)
transfer functions are mathematical representations of a 1
sω= (Te −bω ) =0
system's input-output relationship, in terms of the Laplace J
variable s. They can be used to analyze the stability, frequency
response, and transient behavior of a system, and to design Afterwards in MATLAB we input the symbolic variables
feedback control strategies to meet specific performance via the command “syms”, as well as the equation 1 and 2 and
requirements. doing the recommended variable substitution in eq. 1. With
“subs”. Next, we consider these as a vector under “EQ”, as
The symbolic transfer functions can be manipulated well as the variables ω and I aunder “X”, thus solving these
algebraically using Matlab's symbolic math toolbox, allowing
and saving their values.
for the derivation of closed-form expressions for system
characteristics such as poles, zeros, and frequency response.
It is imperative to evaluate ω and Te as 1 to obtain Gm as
This capability enables engineers to explore the behavior of well as I a and Ua as 1 for Ga. Finally, we employ the
complex systems in a more efficient and systematic way, commands “collect” to collect the coefficients of the variable
leading to the development of more effective and optimized s, “numden” to extract the numerator and denominator stating
control strategies. In this context, Matlab's symbolic transfer these as “n” and “d” respectively and adding the variable of
functions are a powerful tool for the design and analysis of the transfer function next to it, and “pretty” so it is easier to
control systems, providing a powerful platform for the visually comprehend.
development of innovative engineering solutions [1].

II. EXERCISE 1
A. Instructions
Obtain the transfer function of the DC motor using
MATLAB’s symbolic function.

Fig 1. Equation system for exercise 1.


Fig 3. Code used for exercise 1.
C. Results “Gm1n” and “Ga1n” to the numeric LTIs. Thus, having the
following code:

Fig 4. Transfer functions Gm and Ga of exercise 1.

We thus obtain the transfer functions for the DC motor, Fig 6. Preliminary code for exercise
Gm and Ga respectively.
This code generates the following result:
D. Discussion
For this exercise we obtained the transfer function for
the DC motor, the statement of variables can be made in
multiple ways, yet the process still consists of the key
commands. Something remarkable is that it is necessary to
correctly name and save the values, hence we are working
with several of these and any change can create big differences
in the results.

III. EXERCISE 2 Fig 7. Preliminary result for exercise


A. Instructions This result is not incorrect, yet it can be still be simplified,
Declare the transfer functions Gm and Ga of the DC motor therefore we divide both parts of the fraction to obtain a
as numeric LTIs on MATLAB. Use the following parameters: numerator equal to one, so the code is modified to:

Nm
Ra=100Ω ; La=100mH; Kt=0.05 ; J=0.001; b=0.001
A
B. Procedure and observations Fig 8. Modifications to code of exercise 2.
C. Results

Fig 5. Code for exercise 2.

For this exercise we worked from the code previously wrote in


exercise 1, thus starting with the command “subs” to state
these as the variables to be worked with from this moment on.
Firstly, we input the values of each variable. Afterwards with
the “numden” command we extracted the numerator and
denominator stating these as “n” and “d” respectively and then Fig 9. Numeric LTIs for exercise 2
employing the command “sym2poly” to return the numeric
vector of coefficients of the symbolic polynomial. We named D. Discussion
The newer command “sym2poly” is very helpful when
obtaining the numeric LTIs for the transfer function hence it
outputs a fairly simplified fraction and it is only necessary to
C. Results
divide each part of this to obtain a unitary numerator, which is
the common practice for these kind of result.
IV. EXERCISE 3
A. Instructions

Calculate the transfer function of the complete DC motor


symbolically considering its block representation: Fig 12. Symbolic representation of the transfer function.
D. Discusion

For this exercise it can be seen that it is possible to obtain a


symbolic representation of the transfer function of a system
working with the command syms that allows to use symbols
instead of numbers, and in order to enhance its visual
representation it is possible to use commands such as collect()
and pretty().
Fig 10. System of exercise 3.
Tip: Note that in this case G(s) = Ga(s)KtGm(s) y H(s) = Kt. V. EXERCISE 4
A. Instructions
B. Procedure and observations Calculate the transfer function as a numeric LTI variable of
With the syms command is possible to add symbolic variables the whole DC motor with Matlab. Call this variable Gw.
without a numeric value and work with them to obtain the Tip: If you already have Ga, Gm and KT declared from
symbolic representation of the transfer function. exercise 2 just use the feedback() command.

 Check that the numeric result matches the symbolic


result from exercise 3.
 Graph the step response of the motor with an input of
Va = 100V and a charge of 0.1Nm in the time t = 5s.
(Compare the response of this simulation with the
result of the last practice)
B. Procedure and observations
First to check if both results are equal, we are going to
substitute all of the symbolic values to its numeric equivalent.

Fig 11. Block diagram to solve Ex. 3.


C. Results

Fig.15. Verification of the result of the symbolic value and the


numerical value.

Fig 13. Modification of exercise 3 code to get the numeric


answer.

And to get the numeric transfer function it is possible to


obtained with the commands sym2poly() and tf().

Fig.16. Comparison of step response of the motor at 100V


with no load torque.

Fig 14. Numerical response of the transfer function and code


for its visual representation.

Fig.17. Comparison of step response of the motor at 100V


with 0.1 Nm of load torque.
D. Discusion

It can be seen that the symbolic representation and the numeric


value of the transfer function are equal, meaning that it was
nicely translated to a numeric representation.

Regarding the graphs, it can be seen that in the Fig. 15 the


numerical step response matches the response of the previous
report with no load torque, however in the Fig. 16 it can be
visualized that there is a great difference in the amplitude of
the response when applying a load torque; reviewing the code
nothing seem out of placed and we found out that for example Fig.18. Code used for exercise 5 to compare the graphs and
to match the amplitude of Simulink the value of the load obtain the important data.
torque must be around 0.25 Nm while in Simulink 0.1 Nm.
However, something might be wrong.
C. Results

VI. EXERCISE 5
A. Instructions
Apply dominance to the transfer function of the DC motor that
you got in exercise 4. Call this variable Gwa.

Graph the step response of the original system (Gw) and the
approximation and verify if they are approximated. (Tip: Use
the command “hold” to graph both responses in the same
graph).

Calculate the characteristics of both responses and compare


them (Ts, Ga, etc.).

B. Procedure and observations

In order to obtain Gwa it is needed to apply dominance to the Fig.19. Comparison of the step response of the system with
system, and to do so it is important to identify the poles of the and without applying dominance.
transfer function that we got in Ex. 4.

500
Gω= 2
s +101 s+125

500
Gω=
( s +1 ) ( s+ 100 )+ 25
As the dominant pole is (s + 1) and 100 >> 5(1) it is possible
to eliminate the (s + 100) pole applying dominance, just it is
important to remember to conserve the gain of the system.

500
( )
100
Gωa=
( s+1 ) +( 25/100)

5 Fig.20. Closer look to the comparison between the two graphs.


Gωa=
s+1.25
dominance, for example by assuming that the engine is a
single cylinder rather than a multi-cylinder engine. This can
result in a loss of accuracy in the model.

Transient effects: Transient effects such as start-up, shutdown,


and load changes may be neglected or approximated in an
approximate model by dominance, leading to inaccuracies in
the model predictions under transient conditions.

Gw Gwa It is important to note that the level of approximation required


Fig.21 Comparison between the characteristics of both of depends on the specific application of the engine model. For
the step responses. example, a simple engine model may be sufficient for control
system design, while a more detailed model may be required
for performance optimization or emissions analysis. [2]

D. Discusion
B. Under what conditions is it correct and incorrect to use a
model approximated by dominance?
As it can be distinguished in Fig. 19 both steps responses look
very similar, is not just when zooming in that the differences
can be appreciated as seen in Fig. 20, and to prove the little The use of a model approximated by dominance can be correct
differences between the step responses it is possible to see or incorrect depending on the application and the accuracy
their characteristics in Fig. 21 where the settling time is quite required for the analysis.
similar as well as the peak-time, this similarity between the
responses can be explain with the dominance, since the pole A model approximated by dominance is a simplified model
that was eliminated was 100 bigger than the most dominant that is obtained by ignoring the effects of smaller or less
pole, meaning that it didn’t controlled much in the step important factors in a system. This approach can be useful in
response. reducing the complexity of a system and facilitating analysis,
but it may also lead to inaccurate results if the factors being
With this exercise it can be visualized the importance of ignored have a significant impact on the behavior of the
dominance when working with dynamic systems and system.
controllers, allowing us to simplify o stabilizing a system by
eliminating or adding poles without that much impact in the Therefore, it is generally correct to use a model approximated
system. by dominance when the factors being ignored are relatively
small compared to the dominant factors in the system, and
when the resulting approximation is accurate enough for the
intended analysis. This approach can be particularly useful in
VII. CUESTIONARY systems with high dimensionality, where the analysis of the
full system may be computationally expensive or infeasible.
A. In the case of the approximate model by dominance, what
elements of the engine would be neglected? However, it is incorrect to use a model approximated by
In the case of an engine, the elements that are neglected in an dominance when the factors being ignored are significant and
approximate model by dominance depend on the specific cannot be neglected without affecting the accuracy of the
application and the level of approximation required. However, analysis. In such cases, a more detailed model that takes all
some possible elements that could be neglected in such a relevant factors into account should be used, even if it is more
model are: computationally expensive. [2]

Non-linear effects: In a simplified model, non-linear effects


such as friction, wear, and thermal expansion may be C. Besides the feedback command, what other built-in
neglected or approximated by linear effects, which can result commands does Matlab have to perform block algebra?
in inaccuracies in the model.
Matlab has several built-in commands to perform block
Secondary effects: Secondary effects such as fluid dynamics, algebra, including:
combustion dynamics, and heat transfer may be simplified or
neglected in an approximate model by dominance, leading to a blkdiag: This command is used to concatenate matrices
less accurate representation of the engine behavior. diagonally, producing a larger matrix with the original
matrices forming diagonal blocks.
Geometric complexity: The geometric complexity of the
engine may be simplified in an approximate model by
blkmove: This command is used to move blocks of a matrix
around. It can be used to swap blocks, transpose blocks, or
reverse the order of blocks in a matrix.

blkproc: This command is used to apply a function to each VIII. CONCLUSIONS


block of a matrix. The function can be specified as an A. Valle Franco Jorge Augusto (2077447):
anonymous function or as the name of a function in the Matlab
In this laboratory reported I mostly noticed that with the
path.
recently learnt commands we can now obtain the transfer
function for practical problems, such as the DC motor, as well
blkrepmat: This command is used to replicate a block matrix
to obtain these from existing block diagrams; previously we
in a specified pattern.
could plot the behavior, however now we can generate
numerical values to precisely determine properties. While
blockproc: This command is similar to blkproc, but it applies
coding it was seen that to obtain the transfer functions, the
the function to overlapping blocks of a matrix. [3]
process is based mainly on the commands to output the results
in a way that we are visually familiar with, these being
These commands can be used for a wide range of applications,
“solve”, “subs”; “numden”; “collect” and “pretty” and not
including image processing, signal processing, and control
many new commands to obtain these functions were seen.
systems.
B. Vargas Moya Gabriel Jérôme (2077615):
D. What is the difference between having a symbolic transfer With the elaboration of this laboratory report we put in
function and one as an LTI system within Matlab? practice part of the theory that we saw in class, including
block algebra, closed loop equations, dominance, etc. And it
provided us with the tools to be able to use Matlab and get the
In MATLAB, a symbolic transfer function represents a
transfer functions and closed loops that we need in order to
transfer function in a symbolic form, which means that it is
make controllers, it was seen from different perspectives, with
represented using mathematical symbols and expressions
symbolic and numerical resolutions and we learned new
rather than numeric values. On the other hand, an LTI (Linear
commands to be able to get the transfer functions without not
Time-Invariant) system in MATLAB represents a system
much effort, as for example the command solve(), numden(),
whose output is a linear function of its input and whose
sym2poly(), syms, etc. This knowledge will be very important
behavior is not affected by changes in time.
in future reports since with this tools we have a relatively easy
way to get the correct expressions of the transfer function of a
The main difference between a symbolic transfer function and
system.
an LTI system in MATLAB is that a symbolic transfer
function is a purely symbolic representation of the system,
whereas an LTI system is a concrete implementation of the C. Antonio Martínez Valero (1957324):
system in MATLAB. For this report we learned about the commands that allow
us to perform symbolic calculations, which are important for
When you have a symbolic transfer function, you can understanding and analyzing the behavior of control systems
manipulate the transfer function algebraically to derive its in addition to designing controllers that meet specific control
properties, such as its poles and zeros, without having to objectives. In conclusion, MATLAB provides a powerful set
implement the system in MATLAB. This can be useful for of tools for analyzing and designing control systems, including
understanding the properties of a system in a more abstract block algebra, closed loop equations, and dominance analysis.
way. These tools can help engineers to optimize the performance of
control systems and achieve the desired control.
On the other hand, when you have an LTI system, you can use
MATLAB to simulate the behavior of the system and analyze
its response to different inputs. This allows you to study the REFERENCES
system's behavior in a more concrete and realistic way. [1] “Control systemsl - Matlab & Simulink Solutions,” MATLAB
& Simulink Solutions - MATLAB & Simulink Available:
In summary, a symbolic transfer function represents a system https://la.mathworks.com/solutions/control-systems.html
in a purely symbolic form, whereas an LTI system in [2] “Approximate Model by Balanced Truncation at the Command Line,”
MATLAB & Simulink - MathWorks América Latina Available:
MATLAB is a concrete implementation of the system that https://la.mathworks.com/help/control/ug/approximate-model-by-
allows you to simulate and analyze its behavior [4] balanced-truncation-at-the-command-line.html.
[3] “Matlab function,” Implement MATLAB Functions in Simulink with
MATLAB Function Blocks - MATLAB & Simulink - MathWorks
América Latina Available:
https://la.mathworks.com/help/simulink/ug/what-is-a-matlab-function-
block.html.
[4] “Symbolic variables in transfer functions,” MATLAB Answers - https://la.mathworks.com/matlabcentral/answers/261189-symbolic-
MATLAB Central Available: variables-in-transfer-functions

You might also like