Engee documentation
Notebook

Frequency response of MIMO systems

This example shows how the frequency response of a multi-channel system with multiple inputs and outputs (MIMO) can be investigated in two ways: by calculating the frequency response and by calculating singular values.

Before you start, connect the package ControlSystems.jl.

In [ ]:
import Pkg
Pkg.add("ControlSystems")
In [ ]:
using ControlSystems
s = tf('s');

Calculate the frequency response of the MIMO model and analyze the size of the output signal.

In [ ]:
H = ssrand(2,2,3)
mag, phase, w = bode(H)
Out[0]:
([64.35193014748488 110.66105266914876; 4.517702482503937 8.1126829075723;;; 64.35173123989897 110.66071091235746; 4.517688677427745 8.112658012169764;;; 64.35151642715427 110.66034182782086; 4.5176737684629416 8.112631126067845;;; … ;;; 1.3743210863836728 0.48978319836300016; 0.11048789451967378 0.03695369884433167;;; 1.3743208282278998 0.48978365958105596; 0.11048738601888716 0.03694903132103605;;; 1.3743205891888663 0.48978408664557166; 0.11048691517136995 0.03694470890983952], [179.49447401920028 179.48084163877962; 179.43620199457524 179.44556259487726;;; 179.4746496420569 179.4604826340331; 179.41409233664749 179.42382003546894;;; 179.45404793472662 179.43932533235494; 179.39111572573253 179.401224919673;;; … ;;; -179.96421069383405 -0.06983037265621919; -180.50685638303776 -183.24164437539673;;; -179.9655613080031 -0.06719499468835029; -180.48773063550016 -183.11958354405905;;; -179.96686095174016 -0.06465908605398658; -180.4693264552339 -183.00209954377647], [0.0001, 0.00010392174819219933, 0.00010799729747322885, 0.00011223267953450933, 0.00011663416261521083, 0.00012120826077905968, 0.00012596174355495872, 0.00013090164595568805, 0.0001360352788895144, 0.00014137023998011728  …  707.3624548848775, 735.1034291716219, 763.9323346159553, 793.8918371383827, 825.0262759093753, 857.3817289700206, 891.0060814261498, 925.949096316866, 962.2624882623586, 1000.0])
In [ ]:
size_mag = size(mag)
Out[0]:
(2, 2, 420)

The first and second dimensions of the data array mag — this is the number of outputs and inputs . The third dimension is the number of points in the frequency vector w (the bode command determines this number automatically if you do not specify a frequency vector). Thus, mag(i,j,:) — this is the frequency response from the jth input to the ith exit. Array of phase data phase has the same shape as mag.

Plot the frequency response of each input/output pair in .

In [ ]:
bodeplot(H, title = ["Input 1" "Input 2" "" "" "" "" "" ""], leg = false)
Out[0]:

bodeplot reflects the amplitude and phase of the frequency response of each input-output pair in H (Because ssrand generates a random model of the state space, you can see other characteristics other than those shown in the figure). The first column contains graphs of the frequency characteristics of the circuits running from the first input signal to the first and second outputs. The second column is similar, but from the second input signal to the two outputs of the system.

Plot the singular values depending on the frequency.

In [ ]:
sigmaplot(H)
Out[0]:

Chart sigmaplot shows the dependence of the singular values of the MIMO system depends on the frequency. The maximum singular value at a certain frequency is the maximum gain of the system over all linear combinations of input signals at that frequency. Singular values can give a better idea of the overall response, stability, and tuning of a MIMO system than a channel-by-channel Bode graph.

Calculate the singular values in the range from 0.1 to 10 rad/s.

In [ ]:
ω = collect(1:0.001:10);
sv,w = sigma(H,ω)

display([sv,w])
2-element Vector{Array{Float64}}:
 [5.457212482429304 5.461629817019327 … 1.4747258493327937 1.4747227858945642; 0.5374496365843938 0.5377831833004091 … 0.24287151511445718 0.24284864620972058]
 [1.0, 1.001, 1.002, 1.003, 1.004, 1.005, 1.006, 1.007, 1.008, 1.009  …  9.991, 9.992, 9.993, 9.994, 9.995, 9.996, 9.997, 9.998, 9.999, 10.0]

When you call sigma the command returns singular values in the data array sv. Array input data indicate sigma the need to calculate singular values in the frequency range from 0.1 to 10 rad/s. Function sigma returns these frequencies in the vector w. Each line sv contains singular values at frequencies of W.

Conclusion

Using this example, we learned how to study the frequency response of a MIMO system.