034IN "Fundamentals of Automatic Control" - Introduction to MATLAB/Simulink Hands On: State Space Descriptions
Introduction
This live script illustrates some models of dynamical systems (linear or nonlinear, time-invariant or time-variant, continuous or discrete time).
Inspired by the examples illustrated in the live script StateSpaceDescriptionExamples.mlx, you will able to create a Matlab live script in order to simulate the behavior of a continuous time dynamical system.
What you will learn:
- Given a state space description of a dynamical system, how to build a Matlab model for such a system;
- Tune a Matlab model, setting the model parameters (or the simulation parameters) using Matlab code;
- How to run a Matlab model and retrieve the results using a Matlab live script.
A Linear Continuous Time System: a Mechanical System
The dynamics of the system is given by the state-space model derived from conservation balances (of mass, energy, etc.). Applying Newton's second law, we obtain the following state-space description:
where the state variables are
This state-space description may be easily implemented in Matlab.
Proposal: implement a model using a Matlab live script to analyse the evolution of the above described mechanical system. Use the following parameters to configure the system model:
- point masses [kg]:
, and
; - viscous damping coefficients [N s/m]:
; - spring constants [N/m] :
; - initial conditions:

- external forces (inputs):

- simulation time interval [s]:

% Create a state-space description using the MATLAB ode() function, then
% assign the model parameters, the initial state, the simulation configuration.
% Using the same live script, run the simulation, retrieve the result
% and plot the state and output movements.
More exercises available soon.