MODELING and
CONTROL of a
DC MOTOR
“Open-Loop and Closed-Loop
step response analysis”
PROJECT COURSE
EDUARDO FRANCISCO GARCÍA PINA
DIEGO GUTIÉRREZ LARA
UNIVERSITY OF ARAD
2025/2026
REPORT OUTLINE
1.- INTRODUCTION
2.- MATHEMATICAL MODELING OF THE DC MOTOR
3.- MATLAB IMPLEMENTATION
4.- SIMULINK MODEL (OPEN LOOP)
5.- CLOSED LOOP SIMULATION– PROPORTIONAL
CONTROLLER (P)
6.- CLOSED LOOP SIMULATION – PI CONTROLLER
7.- CLOSED LOOP SIMULATION – PD CONTROLLER
8.- CLOSED LOOP SIMULATION – PID CONTROLLER
9.- COMPARISON OF CONTROLLERS
10.- FINAL CONCLUSIONS
1.INTRODUCTION
DC motors are widely used in industrial systems, robotics, automation,
automotive platforms, and mechatronic applications due to their simplicity,
reliability, and ease of speed control. Controlling the angular speed of a DC
motor is a classical problem in control engineering and provides a practical
example of how mathematical modeling, simulation, and feedback control
techniques can be applied in real-world systems.
The main objective of this work is to model, simulate, and analyze the speed
response of a DC motor using both open-loop and closed-loop control
configurations.
First, the open-loop step response is simulated to understand the natural
dynamic characteristics of the motor without feedback. Then, different
controllers such as Proportional (P), Proportional-Integral (PI), and
Proportional-Integral-Derivative (PID) are designed and implemented to
improve system performance.
The controlled system must meet the following performance requirements:
● Settling time: less than 2 seconds
● Overshoot: less than 5%
● Steady-state error: less than 1%
MATLAB and Simulink are used to experiment with the system, tune
controllers, and evaluate performance metrics. The results are documented with
step response plots, system models, and configuration blocks.
2. MATHEMATICAL MODELING OF THE DC
MOTOR
The dynamics of a DC motor can be described using electrical and mechanical
equations that relate input voltage, armature current, electromagnetic torque,
and angular speed. The modeling provided by the Control Tutorials for
MATLAB and Simulink (UMich CTMS) is used as the reference for this work.
2.1 Electrical Subsystem
When a voltage V(t) is applied to the armature, the electrical circuit obeys:
Where:
V(t)= Imput
The last term Keω(t) represents the voltage induced in the motor due to rotation.
2.2 Mechanical Subsystem
The torque generated by the motor is:
T(t)=Kt i(t)
This torque is used to accelerate the rotor, modeled through Newton’s second
law:
where:
J= Rotor moment of inertia
b= Motor viscous friction
Kt=Torque constant
2.3 Transfer Function of the Motor
Combining electrical and mechanical equations, eliminating i(t), and taking the
Laplace transform, the motor transfer function from input voltage V(s) to
angular speed ω(s) becomes:
This transfer function represents the open-loop continuous model of the motor.
2.4 Model Parameters Used
The parameters are taken from the UMich CTMS Motor Speed example:
R= Armature resistance= 1Ω
L=Armature inductance=0.5 H
J= Rotor inertia=0,01kg·m2
b=Viscous friction coefficient= 0.1 N·m·s
Kt =Ke =K= Motor constant = 0.01
These values are later used in MATLAB for generating the open-loop model.
3.- MATLAB IMPLEMENTATION
In this section, the mathematical DC motor model obtained earlier was
implemented using MATLAB. The goal was to translate the theoretical model
into a practical code representation and analyze the system behavior without any
controller.
STEP 1.- Defining parameters
The first step was to assign numerical values to the physical motor constants as
MATLAB needs these parameters to build the transfer function.
STEP 2.- Transfer function
STEP 3.- Open-Loop response
Step response plot:
Final Conclusions from Section 3
The open-loop simulation reveals that the motor can reach a final speed when a
constant voltage is applied.
Important Observations
● The system is slow (settling time is much greater than 2 seconds).
● There is no overshoot, but the response is not fast.
● The steady-state error is significant, meaning the motor speed does not
perfectly reach the desired value without control.
Final Conclusion
The DC motor operating in open loop can not meet the performance
requirements (settling time < 2 s, overshoot < 5%, state error < 1%), therefore a
controller is required to improve the system dynamics and tracking accuracy.
4.- SIMULINK MODEL
This section presents the open-loop simulation of the DC motor using Simulink.
The purpose is to visualize the dynamic behavior of the system in a
block-diagram environment and confirm the same step response obtained
previously using MATLAB.
4.1 Simulation results
After running the model, the motor speed response to a step input voltage is
displayed in the Scope block. This open‑loop response must match the
MATLAB step response obtained previously.
- Slow rise time
- No overshoot
- High steady‑state error
- Settling time greater than 2 second
These characteristics confirm that the motor alone is not able to reach the
desired specifications without a controller.
4.2 Conclusion of the Open‑Loop Simulink Model
The open‑loop Simulink simulation verifies the same dynamic behavior
observed in MATLAB. The DC motor exhibits a slow response and fails to
achieve accurate tracking of the reference input, confirming that closed-loop
control (feedback) is necessary to meet performance requirements.
What can be observed in the plot?
● The output begins to rise at t = 1 s, which indicates that the Step block is
configured with Step time = 1 (not 0).
● The response settles around 0.10 (≈ 0.0999) after a few seconds.
● There is no noticeable overshoot (overshoot ≈ 0%).
● The response is relatively slow: most of the rise occurs between ~1 s and
~2.5 s.
Interpretation with respect to the project requirements
● Overshoot < 5%: Achieved (practically 0%).
● Settling time < 2 s:
The step occurs at t = 1 s, and the system seems to settle around t ≈ 2.5–3
s, which means approximately 1.5–2 s after the step. This is close to or
slightly above the requirement depending on the exact definition of
settling time (2% or 5% band).
To measure it precisely, the stepinfo function in MATLAB should be
used.
● Steady‑state error < 1%: Not achieved if the reference is 1.0 (input step
of 1 V).
The motor output stabilizes at 0.1 rad/s, so the steady‑state error is:
ess = 1 − 0.0999 = 0.9001 → 90% error
● This is far from the required 1%.
If the requirement was based on the final output value (0.1), clarification
would be needed, but typically the comparison is made against the
reference (1.0), so the requirement is not met.
4.3 Conclusion
Without a controller, the system does not meet the steady‑state error
requirement, and it is slightly outside the settling time requirement.
Therefore, a controller (PI or PID) is necessary to improve the performance.
5. CLOSED LOOP SIMULATION– PROPORTIONAL
CONTROLLER (P)
In this section, a closed‑loop control structure is implemented using a
Proportional Controller (P‑controller) applied to the DC motor model.
The goal is to improve performance compared to the open‑loop response, which
was unable to reach the desired value of 1 rad/s.
A proportional controller generates the control action as:
u(t)=Kp(r(t)−ω(t))
where:
● Kp is the proportional gain
● r(t) is the reference input (1 rad/s)
● ω(t) is the motor angular velocity
5.1 Closed‑Loop Simulink Structure
The closed‑loop model consists of:
1. A Step block (reference = 1 rad/s)
2. A P controller block (Gain block set to Kp)
3. The DC motor transfer function
4. Feedback connection using a Sum block
5. A Scope to visualize the output response
5.2 Selection of Kp
The initial value is:
Kp=1
However, with such a low gain, the system does not reach the desired
steady‑state value of 1 rad/s.
Therefore,
Kp is gradually increased until the output approaches the reference without
producing instability or excessive oscillations.
Empirically, values in the range:
Kp≈10–40
produce a significantly improved response.
The exact value will depend on Simulink transfer function parameters.
5.3 MATLAB Code Used for Closed‑Loop Simulation
%% CLOSED LOOP – P CONTROLLER
% DC Motor parameters (same as used in open loop model)
J = 0.01; % inertia
b = 0.1; % damping
K = 0.01; % motor constant
R = 1; % armature resistance
L = 0.5; % armature inductance
%% Transfer function of the DC motor (from CTMS)
num = K;
den = [J*L (J*R + L*b) (b*R + K*K)];
G = tf(num, den); % Motor model
%% Reference value
r = 1; % desired speed = 1 rad/s
%% Test different Kp values
Kp_values = [1 5 10 20 50 100];
figure;
hold on;
for Kp = Kp_values
% Closed-loop transfer function with unity feedback
C = Kp;
T = feedback(C*G, 1); % Closed-loop system
% Simulate step response
[y, t] = step(r * T);
% Plot
plot(t, y, 'DisplayName', ['Kp = ' num2str(Kp)]);
end
title('Closed-Loop Step Response for Different Kp Values');
xlabel('Time (s)');
ylabel('Motor Speed (rad/s)');
legend show;
grid on;
hold off;
5.4 Results and Discussion
With a properly tuned proportional gain:
● The final speed approaches 1 rad/s, meaning the steady‑state error is
reduced.
● The rise time becomes noticeably faster than in open loop.
● A very large Kp may cause oscillations or instability, so tuning is
necessary.
● The controller alone still leaves some small steady‑state error, which
motivates the use of a PI or PID controller in the next sections.
Closed-Loop with Kp=1
Comparison plot with different Kp
6. CLOSED LOOP SIMULATION – PI CONTROLLER
In this section, a Proportional–Integral (PI) controller is implemented in the
closed‑loop structure of the DC motor in order to improve the steady‑state
performance obtained with the P controller.
6.1 Objective
The goal of this section is to analyze the behavior of the DC motor when
controlled using a PI (Proportional–Integral) controller.
Unlike the P controller, the PI controller introduces an integral action that
eliminates the steady‑state error, allowing the motor to reach the reference value
of 1 rad/s.
6.2 Controller Structure
The PI controller used has the form:
C(s)=Kp+Ki*(1/s)
● The proportional term increases the system’s responsiveness.
● The integral term forces the steady‑state error to zero by accumulating the
error over time.
6.2 Simulink Implementation of the PI Controller
PI closed-loop system (Simulink)
6.3 Tuning the PI Controller
● To tune the PI controller, we adjusted the proportional gain (Kp) and the
integral gain (Ki) to achieve a faster response, eliminate steady‑state
error, and avoid excessive overshoot.
● We first increased Kp to speed up the system, observing how the rise time
improved but without reaching the reference. Then we added Ki, which
gradually eliminated the steady‑state error and allowed the system to
reach 1 rad/s.
● The tuning was performed directly in Simulink and also using the “PID
Autotuner / Tune” tool, which provides suggested values for Kp and Ki.
● After several tests, we selected the parameter set that achieved a stable
response, no steady‑state error, and an acceptable settling time.
6.4 Simulation Results
● The output reaches 1 rad/s
(steady‑state error ≈ 0%)
● The rise time is faster than P
controller
● Overshoot may appear depending
on Ki
● The response is generally smooth
and stable
● Settling time improves significantly
compared to open-loop
● Reference = 1 rad/s
● Output reaching the reference
● Time scale (0–3 seconds)
6.5 Analysis of the PI Controller
From the simulation, we can conclude:
● The PI controller successfully eliminates the steady‑state error, unlike the
P controller.
● Increasing Ki reduces error but may cause oscillations if too large.
● Kp mainly affects speed;
● Ki ensures accuracy.
● A well‑tuned PI controller provides:
● 0% steady‑state error
● Small or moderate overshoot
● Acceptable settling time
● Much better performance than the P controller
7.- CLOSED LOOP SIMULATION – PD CONTROLLER
7.1 Objective
The goal of this section is to evaluate how a Proportional–Derivative (PD)
controller improves the dynamic response of the DC motor speed control
system. While the P controller reduces the steady‑state error only slightly and
increases the response speed, it still produces overshoot and does not fully meet
all performance requirements. Adding a derivative term (D) helps improve the
transient behavior by anticipating changes in the error.
7.2 PD Controller Structure
The PD control law is:
Where:
● Kp → increases the response speed
● Kd → adds damping, reducing oscillations and overshoot
Because the motor already behaves like a first‑order system, adding a derivative
term helps to stabilize and accelerate the dynamics.
7.3 MATLAB CODE
7.4 SIMULATION RESULTS
● The PD controller produces a faster and smoother response compared to the
P controller.
● Overshoot is significantly reduced thanks to the derivative action.
● The system does not fully remove steady‑state error because the integral term
is not present.
● The closed‑loop behavior is more stable and less oscillatory.
Simulink Plot; Kp=20, Kd=0,1, Ki=0
7.5 CONCLUSION
The PD controller improves the dynamic response of the DC motor compared to
the open‑loop system and the P controller. By adding the derivative term, the
system becomes more stable, with reduced oscillations and noticeably lower
overshoot. The proportional gain Kp accelerates the response, while the
derivative gain Kd introduces damping, preventing instability.
However, despite the improvements in speed and stability, the PD controller
cannot eliminate the steady‑state error. This means that the motor speed does
not reach the reference value of 1 rad/s, even after tuning both gains. For this
reason, the PD controller is useful for shaping the transient response, but it is
not sufficient when accurate steady‑state tracking is required.
8.- CLOSED LOOP SIMULATION – PID CONTROLLER
The PID controller combines proportional (Kp), integral (Ki), and derivative
(Kd) action into a single control law that provides the best trade‑off between
speed, accuracy, and stability.
Unlike the P or PD controllers, the PID can eliminate the steady‑state error
while also shaping the transient response to avoid overshoot and oscillations.
The goal of applying a PID controller to the DC motor is to:
● Achieve a fast rise time
● Reduce or eliminate steady‑state error (reach 1 rad/s)
● Avoid large overshoot
● Improve damping and stability
This makes the PID the most complete and effective controller for this
system.
8.1 MATLAB CODE
PID Simulink Plot
8.3 CONCLUSION
The PID controller provides the best overall performance among all the control
strategies tested (P, PI, and PD). By combining proportional, integral, and
derivative actions, the PID controller is able to significantly improve both the
transient and steady‑state behaviour of the DC motor.
The proportional term accelerates the response, the derivative term reduces
oscillations and overshoot, and the integral term eliminates the steady‑state
error. As a result, the closed‑loop system is able to reach the reference speed of
1 rad/s with zero steady‑state error, while maintaining a fast and stable response.
Using Simulink’s PID Tuner allows automatic tuning of the parameters,
achieving an optimal balance between speed, stability, and accuracy.
Overall, the PID controller is the only one that fully satisfies the performance
requirements: fast rise time, low overshoot, stable behaviour, and perfect
tracking of the desired output. It represents the most complete and effective
control solution for the DC motor speed regulation problem.
9. FINAL CONCLUSIONS
This study evaluated the dynamic behavior of a DC motor under both open‑loop
and closed‑loop operation using different types of controllers: P, PI, PD, and
PID. Each controller was tested with tuned parameters in order to achieve the
main performance objectives: fast response, low overshoot, minimal
steady‑state error, and good overall stability. The following conclusions
summarize the results obtained throughout the project.
1. Open‑Loop Behavior
The open‑loop simulation clearly showed that the DC motor is unable to reach
the desired reference of 1 rad/s when a step input is directly applied. The
steady‑state value remains significantly below the reference, producing a large
steady‑state error (≈90%).
This demonstrates that feedback control is essential for achieving the
performance required by the assignment.
2. Proportional Control (P)
Introducing proportional control significantly improved the system’s response.
As the proportional gain increased:
● The steady‑state error was reduced, but never fully eliminated.
● The speed of the response increased as Kp increased.
● However, high values of Kp introduced overshoot and oscillations,
compromising stability.
Overall, P control improves tracking but cannot remove steady‑state error,
making it insufficient for precise speed regulation of the motor.
3. PI Control
The PI controller produced a substantial improvement compared to pure P
control:
● The integral action eliminated the steady‑state error, ensuring that the
motor reached exactly 1 rad/s.
● The response became smoother and more stable, provided that Ki was not
excessively large.
● A very high Ki caused overshoot and slower settling due to integral
wind‑up.
Thus, the PI controller achieved accurate tracking and stable convergence,
making it well-suited for speed control applications where zero steady‑state
error is critical.
k
4. PD Control
The PD controller behaved differently:
● The derivative term increased damping, reducing overshoot and
improving the transient response.
● The system became more stable at higher gains, compared to the P
controller.
● However, like the P controller, the PD controller cannot eliminate
steady‑state error on its own.
Therefore, PD control is effective at shaping the transient response but
insufficient for precise long‑term accuracy.
5. PID Control
The PID controller combined the advantages of all previous methods:
● The P term improved speed of response.
● The I term ensured zero steady‑state error.
● The D term reduced overshoot and improved damping.
The resulting closed‑loop response showed:
● Fast rise time
● Minimal overshoot
● Short settling time
● Zero steady‑state error
● High stability and smooth convergence