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).
引用格式
Andrey Popov (2024). makeStateSpaceModel (https://www.mathworks.com/matlabcentral/fileexchange/55234-makestatespacemodel), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0.0 | Update of the Description |