Balancing Transformations: Simplifying Data-Driven Control

Welcome back, folks! In our previous sessions, we delved into the fascinating world of balancing transformations. These coordinate alterations take us from the original x-coordinates to a new set of z-coordinates, where our controllability and observability Gramians, a diagonal and hierarchically ordered matrix sigma, become WC hat equals wo hat equals a diagonal matrix.

Let’s explore how to implement this in MATLAB for a clearer understanding. Our end goal is to generate a figure that showcases the observability and controllability Gramians of our original system. In the plot, the controllability Gramian is depicted in red and the observability Gramian in blue. One direction appears highly controllable while the other is less so. Our aim is to find a balanced transformation, denoted as T, that brings these Gramians into equilibrium.

To begin, we create a two-by-two system with a single input and output, devoid of D-matrix and feed-through terms. With MATLAB’s SS command, it’s easy to build a state-space system (a, b, c matrices) that represents the system. We can then examine the controllability and observability Gramians using the convenient ‘gram’ command.

Now, let’s plot these Gramians to visualize our system’s behavior. By defining a unit sphere or circle in R2, we can map it through the controllability and observability Gramians. Considering that these Gramians are positive semi-definite, we utilize the square root of the Gramians for scaling. Consequently, our circle transforms into controllability and observability ellipses, beautifully illustrating the system’s characteristics.

Now that we’ve observed the controllability and observability of our original x-coordinates, our next step is to find a balanced realization of the system. Fortunately, MATLAB makes this task a breeze with one line of code: ‘balreal’. This command grants us access to the balanced system, the transformation T, and its inverse. We can then examine the Gramians of the balanced system. In these balanced coordinates, the Gramians should be equal and diagonal.

Further reading:  Computing Derivatives with FFT in Python

To visualize the balanced system, we map our ellipse from before into the z-coordinates and then back into the x-coordinates. The resulting purple ellipsoid represents a compromise between the red and blue controllability and observability ellipses. This balanced ellipsoid enables us to maintain good observability and controllability simultaneously, providing an optimal solution.

The process is surprisingly simple, as demonstrated by the one-line MATLAB command for balancing the system. By running ‘balreal’ on our system, we obtain a balanced model, as well as the direct and inverse transformations. Any subsequent verification serves merely to confirm the validity of the balanced model.

The beauty of this approach lies in its scalability. Though we showcased a two-by-two system for clarity, the same concepts apply to larger systems. As the dimensions increase, these ellipsoids extrapolate into hyper-ellipsoids, and the preferred directions and trade-offs between controllability and observability persist.

Now, it’s worth noting that I’ve written a manual code for computing these balancing transformations, in case you’re interested. The code follows the same principles we discussed earlier. However, for simplicity, I recommend utilizing the built-in ‘balreal’ command. The ultimate result will be the same.

To summarize, with just one line of MATLAB code, we can transform a system with distinct observability and controllability directions into a balanced realization. This process organizes the coordinates hierarchically, from the most to the least important, allowing us to approximate a high-dimensional system with a lower-dimensional one that captures its most critical aspects. This newfound control and simulation capability is invaluable when dealing with large-scale systems.

That’s all for now. Thank you for joining me on this spellbinding journey into data-driven control. Feel free to explore the code online and witness the magic for yourself. Until next time!

Further reading:  Spectrogram Analysis: Unveiling the Power of Time-Frequency Diagrams

Techal

YouTube video
Balancing Transformations: Simplifying Data-Driven Control