First-Order Speed Reponse Simulation
This experiment simulates the response of a first-order dynamic system approaching a desired speed. Using Forward Euler integration, I investigated how the time constant affects response speed and how discrete time steps approximate continuous-time behavior.
Model a first-order system in MATLAB and evaluate how changes in the time constant affect its response to a commanded speed of 5 m/s.
I ran three simulations with identical initial conditions and a target speed of 5 m/s, changing only the time constant.
I implemented a Forward Euler numerical simulation using the first-order differential equation:
dx/dt = (u - x)/tau
At each time step, the simulation calculates the rate of change from the difference between the current and desired speeds, then updates the speed using:
xn+1 = xn + (u - xn)/tau * dt
The MATLAB implementation consists of two files:
simulateFirstOrderSpeed.m: Calculates the speed response using Forward Euler integration.
compare_sim.m: Runs simulations with different time constants and plots their responses.
I ran three simulations with identical initial conditions and a target speed of 5 m/s, changing only the time constant. The simulation duration for each run was 5τ which resulted in 99.3% of the final steady-state response.
RED --> τ = 0.1s
GREEN --> τ = 0.5s
BLUE --> τ = 1.0s
The results show that the simulation with τ = 0.1 approached the target speed fastest, followed by τ = 0.5 and τ = 1.0. This demonstrates that smaller time constants produce faster system responses.
I observed that the inverse of the time constant scales the speed error, resembling how proportional gain influences a controller's response.
I also learned that Forward Euler integration approximates the continuous-time response by assuming a constant rate of change within each time step. Consequently, the accuracy of the simulation depends on the selected time step.
This experiment strengthened my understanding of first-order system behavior and numerical simulation, providing a foundation for more advanced control-system models.
This relates to the next experiment as one of the numerical methods used in comparison in the following experiment is Semi-Implicit Euler which has its similarities with Forward Euler Integration as they are both sequential based.