Matavecontrol is a free software library for control engineering. Matavecontrols goal is to offer a library for control engineering which can be used for both MATLAB and GNU Octave. Matavecontrol is using a combination of both GNU Octave and MATLAB code.
Developer(s) | Daniel MÃ¥rtensson |
---|---|
Initial release | 2017 |
Stable release | 1.5
/ Nov 18, 2017 |
Written in | MATLAB, GNU Octave |
Operating system | Windows, Linux, MacOS |
Type | Control engineering |
License | MIT License |
Website | github |
Developments
editThe developments behind this project are built on to work with both MATLAB and GNU Octave.
Technical details
editMatavecontrol is using most of the time built in functions and for-loops to compute transfer functions, state space models and other types of matrices.
The language
editGNU Octave and MATLAB share the same basic built in functions such as eig, ode45, inv etc.
- The function are.m is using ode45 to solve Algebraic Riccati Equations
- The function tf.m is using struct and cellarrays to do string handling
- The function lyap.m is using kronecker product to find the solution to the Lyapunov equation
- The function pid.m is creating a transfer function as a PID-controller.
- Matavecontrol is using functions such as "or" and "and" insted of "||" or "&&".
Difference between Control System ToolBox and Matavecontrol
editMatavecontrol works with both discrete time models and continuous time models. Control System ToolBox from MathWorks is separating functions depending if it's discrete time or continuous time. For example "dlyap.m" and "lyap.m" or "dare.m" and "care.m".
Matavecontrol has the same name on the functions as Control System ToolBox has. But insted Matavecontrol have included the discrete time and continuous time functions in the same function. Matavecontrol requrie that the user always create a transfer function or a state space model to begin with. That model can then be used in almost all functions.
Function reference
editHere is some examples how to use Matavecontrol.
>> G = tf([1 2], [1 0.4 5], 3) % 3 is the delay - Optional
G =
scalar structure containing the fields:
num =
1 2
den =
1.00000 0.40000 5.00000
delay = 3
tfnum = s + 2
tfdash = ---------------
tfden = s^2 + 0.4s + 5
type = TF
sampleTime = 0
Creating a state space model.
>> sys = ss(1, [0 1; -2 -3], [0; 1], [1 0], [0]) % Here is the delay 1 a requriment, but C, D are opional
sys =
scalar structure containing the fields:
A =
0 1
-2 -3
B =
0
1
C =
1 0
D = 0
delay = 1
type = SS
sampleTime = 0
Here is an example how to find the solution to the Algebraic Riccati Equation. In this case, sys, is a continuous model. Which result that are.m choosing the continuous Algebraic Riccati Equation. If sys was discrete, then are.m is choosing discrete Algebraic Riccati Equation.
>> Q = [1 0; 0 1], R = 5
Q =
1 0
0 1
R =
5
>> X = are(sys, Q, R) % Find the solution to Algebraic Riccati Equation
X =
1.24690 0.24690
0.24690 0.24690
>>
How to interprent the help text. Here we can se that t should only be a real number such as 10, 11 or 24.2. G symbols a transfer function and sys symbols a state space model.
>> help step
Simulate continuous time model of a state space model or transfer function
Input: G, sys, t(optional)
Example 1: step(G, t)
Example 2: step(G)
Example 3: step(sys, t)
Author: Daniel MÃ¥rtensson, 2017 September