An array of models with one variable parameter
This example shows how to create a one-dimensional array of transfer functions. One parameter of the transfer function varies from model to model in the array. You can use such an array to study the effect of parameter changes on your model, for example, to analyze sensitivity.
import Pkg
Pkg.add("ControlSystems")
using ControlSystems
s = tf('s');
Create an array of transfer functions representing the following low-pass filter at three cutoff frequency values .
Create transfer function models representing a filter with a cutoff frequency = 3, 5 and 7.
a = [3, 5, 7]
F_array = [ tf([a[i]],[1,a[i]]) for i=1:length(a) ]
The inclusion method allows us to create a vector of transfer functions with a variable parameter.
Let's construct a Bode diagram for F_array
.
bodeplot(F_array)
When you use analysis commands such as bodeplot
For an array of models, the resulting graph shows the response of each model in the array. This way, you can see the range of responses resulting from parameter changes.
The models from the vector can be combined and a MIMO system can be obtained.
Converting an array of systems into a multidimensional system
You can create a diagonal multidimensional system from a vector of systems using the function append
. As a result, we will have a system with three inputs and three outputs.
P1 = append(F_array[1], F_array[2], F_array[3])
Other function array2mimo
allows you to create a system with one input and three outputs.
P2 = array2mimo(F_array)
To return to the array of systems or get a vector from the MIMO system, you can apply the function getindex
.
sys_array = getindex.(Ref(P2), 1:P2.ny, (1:P2.nu)')
Conclusion
We looked at how to create an array of models with a variable parameter.We also learned which functions allow you to switch from an array to a MIMO system and back.