# control of linear network

We have a linear network with n nodes, of the form: $$\dot{x} = Ax$$. I would like to apply some concepts of linear control theory to the network and see how it goes, by using Matlab.

1. As a first step I understand that this form of systems have only one fixed point at 0.
2. We need therefore to see what this point is, regarding its stability. I would think of 3 possible ways to do that:
A. by plotting the solutions and see if any of them explode to infinity, just as a basic way of getting intuition on the behaviour of all solutions in a small time-window (this way of course cannot be a safe way to assess its stability since one would have to check for infinite time) B. by assessing the eigenvalues of the system, here we have two that are positive:0.0102, 0.0100, -0.0177, -0.0172, -0.0092, -0.0090, -0.0000, -0.0000, -0.0003, -0.0003
C. by checking the values of the determinant, trace and discriminant of A. Here the determinant Det = 3.7870 10^(-28) (positive), the trace Tr=-0.0335 (negative), and the discriminant $$\Delta =Tr^2-4Det=0.0011$$

1st question: I would expect the trace to be positive, as it indicates unstable behaviour which is clearly the case for the specific system. What might be the reason for this discrepancy? Or is it that I got it wrong?

Let us assume for a moment that the system is indeed unstable at the origin. By use of control, we would like to make this fixed point stable.Therefore, I need to find such a $$\u(t)\$$ that if applied to the system appropriately (an appropriate $$\B\$$ is required) it will shift its dynamics from unstable to stable. For this $$\u(t)\$$ to exist, it is required that the system be controllable, under the specific $$\B\$$. I have calculated potential $$\B\$$ matrices that render the system controllable, so one could consider now the system $$\dot{x}=Ax+Bu$$, as controllable. We are still looking for the $$\u\$$ that has the form $$\u=K(r-y)\$$, where $$\K\$$ is a matrix we will compute, $$\r\$$ is the reference we want to achieve, $$\y=Cx\$$ are the measurements, and $$\C\$$ is the identity matrix if we have full-state feedback. So, we have: $$\dot{x} = (A-BKC)x + (BK-A)r$$. In other words, given that the system $$\dot{x}=Ax$$ was unstable as we assumed, we add a controller which which will transform $$\A\$$ matrix accordingly such that the eigenvalues of the "new $$\A\$$" matrix be stable: the "new $$\A\$$ matrix" is $$\A-BKC\$$. I used the place command to just make only the positive eigenvalues negative, while keeping the negative ones as they were. The reference $$\r\$$ is just zeros. The result is the following, and shows all solutions going to zero The problem is that even if I use a $$\B\$$ which doesn’t grant controllability to the system (so, if I choose different nodes), the result still shows all solutions converging to 0: I would expect that in the uncontrollable case, things would be a little less "prone to convergence"

2nd question: Why is that happening? Does it have something to do with the system being linear and probably easy to be stabilised if not controllable? Or is there any misconception in the use of the closed-loop method above?

3rd question: I realised that the computation of controllability of the system depends significantly upon the decimals of the values of $$\A\$$ matrix. For instance, the components of the matrix I used to produce the results above, were of an order of magnitude of 10^(3). To control this $$\A\$$, one node was never enough. On the other hand, when I scaled this $$\A\$$ matrix by something like 30, one node was always enough to control the whole network. Does it have something to do with the how the occurring rank of the controllability matrix is being read by Matlab, when after several multiplications of $$\A\$$ with itself it quickly becomes a very small number?

really sorry for the long post!

1st question: I would expect the trace to be positive, as it indicates unstable behaviour which is clearly the case for the specific system. What might be the reason for this discrepancy? Or is it that I got it wrong?

I don't think that this trace condition you mentioned holds in general. From linear algebra we have that $$\text{tr}(A)=\sum_{\lambda \in \Lambda(A)} \lambda \\ \text{det}(A)=\prod_{\lambda \in \Lambda(A)} \lambda \\$$
where $$\\Lambda(A)\$$ are the eigenvalues of matrix $$\A\$$. And, to be unstable all it takes is one positive eigenvalue. So you can easily come up with systems that are unstable and have negative trace (one small positive eigenvalue and all other eigenvalues very negative.) Regarding the determinant, "[h]ere the determinant Det = 3.7870 10^(-28) (positive)" might be incorrect, because it is a very small quantity of the order $$\10^{-28}\$$ so it might be nonzero due to numerical error. The discriminant also does not help much for large matrices, check out discriminants for n>4.

and C is the identity matrix if we have full-state feedback.

No, if you are using the output signal (without an observer/filter) for your control that is called static output feedback. If you had a measurement of the whole state $$\x\$$ you would call it full-state feedback. It is not always possible to stabilize a system using static output feedback.

The problem is that even if I use a B which doesn’t grant controllability to the system (so, if I choose different nodes), the result still shows all solutions converging to 0:

I would expect that in the uncontrollable case, things would be a little less "prone to convergence"

Even if you don't have controllability you might be able to stabilize a system, say you have $$\dot x = A x + Bu, \quad A=\begin{bmatrix} -1 & 0 \\ 0 & 1\end{bmatrix}, \quad B = \begin{bmatrix} 0 \\ 1\end{bmatrix}$$ it is not controllable, but you can make it stable.

2nd question: Why is that happening? Does it have something to do with the system being linear and probably easy to be stabilised if not controllable? Or is there any misconception in the use of the closed-loop method above?

The only thing that is wrong is the usage of that output matrix $$\C\$$ in the feedback, other than that it seems fine. I also don't know what the place function does when the system is not controllable. But you can check if it is stable by looking at the eigenvalues of $$\A-BK\$$.

3rd question: I realised that the computation of controllability of the system depends significantly upon the decimals of the values of A matrix. For instance, the components of the matrix I used to produce the results above, were of an order of magnitude of 10^(3). To control this A, one node was never enough. On the other hand, when I scaled this A matrix by something like 30, one node was always enough to control the whole network. Does it have something to do with the how the occurring rank of the controllability matrix is being read by Matlab, when after several multiplications of A with itself it quickly becomes a very small number?

I don't quite understand what you are asking here, like, if you have some positive number $$\\alpha\$$ and $$\tilde A = \alpha A$$ then, $$\(A,B)\$$ is not controllable iff $$\(\tilde A,B)\$$ is not controllable. Just look at the controllability matrix for $$\(\tilde A,B)\$$ $$\mathcal{C}_{(\tilde A,B)} = \begin{bmatrix} B& \tilde AB& \tilde A^2B && \tilde A^{n-1}B\end{bmatrix}$$ which differs from controllability matrix for $$\(A,B)\$$ by having its columns being multiplied by some positive number, which should not change the rank of the matrix $$\mathcal{C}_{(\tilde A,B)} = \begin{bmatrix} B& \alpha AB& \alpha^2 A^2B && \alpha^{n-1} A^{n-1}B\end{bmatrix}$$

• thank you so much for the answer. Just a couple of comments: 1. "So you can easily come up with systems that are unstable and have negative trace (one small positive eigenvalue and all other eigenvalues very negative.). True, but the problem is that the negative trace is being followed by non-negative Determinant. if both were negative, that would be good, and the point would be saddle Jul 29, 2021 at 21:34
• 2. "2. Regarding the determinant, "[h]ere the determinant Det = 3.7870 10^(-28) (positive)" might be incorrect, because it is a very small quantity of the order 10−28 so it might be nonzero due to numerical error."" I feared this too but I have no way of assessing it. Jul 29, 2021 at 21:35
• "the problem is that the negative trace is being followed by non-negative Determinant. if both were negative, that would be good, and the point would be saddle" what do you mean by that? You can construct an unstable matrix, with negative determinant and negative trace. In fact, you can find an unstable matrix with any determinant and any trace.
– jDAQ
Jul 29, 2021 at 22:01
• I keep having in mind the stability diagram where depending on the values of determinant, trace and discriminant, one can deduce the stability of a system x_dot=Ax. According to that, unstable systems are either with negative determinant (no limitation for the other two) or positive determinant and positive trace. Could you give an example of an unstable system with positive determinant and negative trace? That might help me understand what I am missing Jul 29, 2021 at 22:24
• As far as I know that only works for planar systems (state in $\mathbb{R}^2$). Look at the unstable $$\begin{bmatrix} 1 && \\ & -1 & \\ && -1\end{bmatrix},$$ it has positive determinant and negative trace
– jDAQ
Jul 29, 2021 at 22:33