# Finding range of variable for which eigenvalue of matrix is negative.

17 views (last 30 days)
Manas on 1 Feb 2024
Commented: John D'Errico on 2 Feb 2024
I have the following matrix having a variable T -
Matrix = [ 0 1 -1;
1 0 0;
-1 0 (-2/T) ]
I need to find the range of T for which all eigenvalues will be either negative or zero. How can I do this in matlab please ?

John D'Errico on 1 Feb 2024
Edited: John D'Errico on 2 Feb 2024
These are never trivial. You have a 3x3 matrix. It will have 3 eigenvalues.
syms T
Matrix = [ 0 1 -1;
1 0 0;
-1 0 (-2/T) ];
The matrix is symmetric. So it will ALWAYS have 3 real eigenvalues, some of which may be duplicated. When will all three eigenvalues be zero or negative? So, for which values of T?
I'd suggest the trick is to convert the matrix to its characteristic polynomial.
syms lambda
P = expand(det(Matrix - lambda*eye(3)))
P =
What can we do now?
You need to understand that the eigenvalues are the roots of this polynomial. How many are positive? The number of negative or zero roots will be three minus the number of positive roots.
Of course, there will NEVER be any zero eigenvalues, since that would require 2/T be zero. (2/T is the constant term, considering lambda as the unknown. And a zero root will require it be zero.) That can only happen when T is infinite. So for any finite value of T, there will ALWAYS be 3 non-zero eigenvalues. The eigenvalues will always be real since the matrix is suymmetric.
We should consider Descartes' rule of signs. This is a nice toy that few people seem to remember. Maybe they don't teach it in school anymore. But it is terribly useful if you want to know the number of positive or negative roots of a polynomial.
This rule says to count the number of sign changes in the coefficients of the polynomial. Call that number S. Then the number of positive roots will be at most the number of sign changes, S, but also, the number of positive roots will differ from S by ALWAYS, an even number. So if the number of sign changes is an odd number, then there will ALWAYS be at least one positive root. Do you follow that logic? I don't think I explained it very well.
Maybe best to offer an example.
syms r1 r2 r3
Expoly = expand((lambda + 1)*(lambda+2)*(lambda+3))
Expoly =
As you can see, three negative roots, -1,-2,-3. And ZERO sign changes. So Decartes' rule of signs tells us there are no more than zero positive roots.
I'll write it in order of decreasing powers of lambda, so we would have:
lambda^3 + 2/T*lambda^2 - 2*lambda - 2/T == 0
How many sign changes are there? If T is positive, then we see EXACTLY ONE sign change. Then there will always be one or more positive roots when T is a positive, finite value. And it also says that when T is positve, there will NEVER be more than 1 positive root. So EXACTLY one positive root for positive T.
Next, suppose T is negative? How many positive roots are there? Now we see TWO sign changes. That says for negative values of T, there will either be TWO or zero positive roots. At least we have some result. You MAY have 3 negative roots when T is negative, but there is no assurance.
Personally, I often feel it is a useful thing to look at an example or two...
vpasolve(subs(P,T,-1))
ans =
As I said, when T is negative, 2 or zero positive roots. When T is positive...
vpasolve(subs(P,T,1))
ans =
So as I said, ALWAYS exactly one positive root for positive T.
vpasolve(subs(P,T,-100000))
ans =
But, do you see that as T gets larger and larger towards -minus infinity, we always end up with two positive roots? As well, one of the roots will approach zero, but from above. (We can prove that as T approaches minus infinity, one eigenvalue will go to zero., but also that it will approach zero from above.)
Next, as T goes to -inf, getting infinitely large, the cubic polynomial will approach
lambda^3 - 2*lambda == 0
And this can easily be factored, to yield the roots [0,sqrt(2),-sqrt(2)].
So under what circumstances will that matrix have THREE negative (non-positive) eigenvalues? NEVER. There are no real values of T that will produce three negative eigenvalues. Effectively, in order to have three negative roots, you need a polynomial with NO sign changes in the roots, where all coefficients are positive (assuming the lambda^3 coefficient is 1). And that never happens for that polynomial, and therefore, never for the eigenvalues of that matrix.
Manas on 2 Feb 2024
Thanks a lot....this helps !!! Actually I think I had studied something similar to this in Routh Stability Criteria, but didn't remember to apply it here. Anyways nice explanation.
John D'Errico on 2 Feb 2024
It is surprising how often I have used the Descarte rule on this forum. A useful tool.

Steven Lord on 1 Feb 2024
syms T
Matrix = [ 0 1 -1;
1 0 0;
-1 0 (-2/T) ]
Matrix =
You can compute the eigenvalues symbolically, but they're not pretty.
D = eig(Matrix)
D =
Even simplifying them doesn't help that much.
D = simplify(D)
D =
D = expand(D)
D =
You could try substituting values for T and checking if the results are all non-positive:
resultm1 = vpa(subs(D, T, -1))
resultm1 =
But let's take a step back. For what reason are you trying to find the range of T for which the eigenvalues are non-positive? Perhaps if you tell us your ultimate goal, there may be a function or a series of functions you can use to achieve that goal in a different way, one that doesn't require trying to solve those complicated equations (or really, inequalities!)
Manas on 1 Feb 2024
Edited: Manas on 2 Feb 2024
Thanks a lot for your help !!! Actually, I am working of a project related to non linear control (vehicle platoon control) where I need to show that my vehicle model (including PD controller) is negative imaginary sytem (which basically have phase lag between 0 and -180). This can be done using the condition given below.
The A matrix of the linearised vehicle state space model given by-
A = [0 1 0;0 0 1;-1 -1 -1/T]
where T is engine time constant of vehicle which we can restrict as per our need.
I need to show this for the system to be negative imagnary-
To solve this I took simplest choice Y = I (identity matrix) and using it in the first condition I arrived at the matrix in Question. The B and C matrices are respectively -
B = [0;0;1/T]
and C = [Kd Kp 0]
where Kd and Kp are also variables (physically gain of PD controller that I can vary) and I need to find the range of T, Kd and Kp over which both these conditions hold.
I know this is a bit mathematical so any help would be appreciated.

Sam Chak on 2 Feb 2024
I'm not sure how you mathematically derived the matrix in the question. However, based on your comment, the 3-by-3 state matrix of the linearized vehicle platoon system does have a characteristic polynomial of 3rd order:
If you establish and analyze the Routh–Hurwitz Stability array, you will arrive at the stability criterion:
Now, we can verify it by assigning five values {0.0, 0.0001, 0.5, 0.9999, 1.0}. The 2nd to 4th elements satisfy the stability criterion. The results indeed show that the 2nd, 3rd, and 4th sets of eigenvalues have negative real parts (or lie in the left half-complex plane).
%% Verify the range of T
A = @(T) [ 0 1 0;
0 0 1;
-1 -1 -1/T];
T = [0, 0.0001, 0.5, 0.9999, 1];
for j = 1:numel(T)
eig(A(T(j)))
end
ans = 3×1
NaN NaN NaN
ans =
1.0e+03 * -10.0000 + 0.0000i -0.0000 + 0.0000i -0.0000 - 0.0000i
ans =
-0.1226 + 0.7449i -0.1226 - 0.7449i -1.7549 + 0.0000i
ans =
-1.0001 + 0.0000i -0.0000 + 1.0000i -0.0000 - 1.0000i
ans =
-1.0000 + 0.0000i 0.0000 + 1.0000i 0.0000 - 1.0000i
Coming back to your matrix in question, it is evident that when it is transformed into the characteristic polynomial, the second-last and last terms do not meet the necessary condition for stability, which is that "all coefficients must have the same sign."
%% Characteristic Equation
syms T s
M = [ 0 1 -1;
1 0 0;
-1 0 -2/T];
CE = expand(det(s*eye(3) - M));
CE = collect(CE, s)
CE =
Based on the state matrix of the linearized vehicle platoon system, if the value of T in the term falls outside the stability range, you will have limited control over the system using the PD controller. In this case, the gains of the controller only affect the and terms.
Sam Chak on 2 Feb 2024
To the best of my knowledge, it is quite challenging to analytically determine the ranges of three parameters simultaneously using the symbolic approach. Instead, the values are typically found through a brute-force search over a small interval. In this case, you could fix the value of T and then adjust or to observe the effect on the phase.
Suggest you post a new question so that experts in frequency response design can offer their valuable advices.
T = 0.850014425356654; % fixed
Kp = 6.51490125494172; % decreasing Kp to 0 makes Pm approaches -65.8°
Kd = 7.73945242427081; % increasing Kd to ∞ makes Pm approaches -90.0°
A = [0 1 0; 0 0 1; -1 -1 -1/T];
B = [0; 0; 2/T]; % another B matrix (the first one you showed)
C = [Kd Kp 0];
D = [0];
Gc = tf(ss(A, B, C, D))
Gc = 15.33 s + 18.21 ----------------------- s^3 + 1.176 s^2 + s + 1 Continuous-time transfer function.
margin(Gc), grid on
Manas on 2 Feb 2024
@Sam Chak thanks for the insight....I'll post a new question accordingly.

### Categories

Find more on Stability Analysis in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!