makeStateSpaceModel
The function assists the definition of state-space models based on first principles (i.e. when the state-equations are explicit).
Instead of trying to substitute the coefficients directly in the system matrices (which often results in confusing matrices and poor flexilbility), this function allows writing down the state-equations as they are. For this purpose variables corresponding to the states, inputs and outputs are generated in the workspace.
To use the function follow the steps below. As a running example, assume you want to model an L-C-R circuit, where L, R and C are defined in the workspace.
1. Specify the names of the states and inputs (as cell arrays) and evoke the function to generate corresponding variables in the workspace
X_names = [{'uC'}; {'iL'}];
U_names = [{'u_in'}];
makeStateSpaceModel( X_names, U_names )
This generates appropriate variables uC, iL and u_in the the workspace.
2. Use generated state and input variables to describe dx/dt (or x(k+1)) and the outputs. The state-change should be named ddt_(state-name)
ddt_iL = (u_in - uC) / L;
iR = uC / R;
ddt_uC = (iL - iR) / C;
u_out = uC;
Y_names = [{'u_out'}; {'iR'}];
3. Evoke the function once more to create the state-space model
G = makeStateSpaceModel( X_names, U_names, Y_names )
The function requires only the ss-function from the Control Systems Toolbox and can be used also under Octave (+ control toolbox).
Citar como
Andrey Popov (2024). makeStateSpaceModel (https://www.mathworks.com/matlabcentral/fileexchange/55234-makestatespacemodel), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Compatibilidad con las plataformas
Windows macOS LinuxCategorías
Etiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
Versión | Publicado | Notas de la versión | |
---|---|---|---|
1.0.0.0 | Update of the Description |