Solving Eigenvalues of a system time-varying which is 5x5 matrix

I am trying to solve this system by using a desired eigenvalues to be equated to the det(SI-A) ,so every thing in that matrix is know except Lambda's , I decoupled the problem by making eta_tilde=0 and then e =0 and I managed to obtain L and it was easier to get L in that way ,but the problem now is to obtain lambda that makes this matrix aysmptoically stable , SINCE it is linear time-varying w.r.t the error so according to lypunov it is better to check the stablity of (A^T+A) to place the eigenvalues to zero, it is complex to solve manually ,so I used the matlab to get the det(SI-A) symbolically ,but how to solve for lambda's.

13 Comments

Your explanations are really confusing. Take a breath and try again.
Why 5x5 ? What is A ? How do you obtain L ?
Best you include your MATLAB code so far.
Typically for a 5 x 5 matrix, the eigenvalues are the roots of a quintic equation. Most quintic equations do not have roots that are representable as algebraic numbers, so solving symbolically would typically at best get you root() representations rather than exact representations.
Dear Torsten, sorry for the confusion,I will rephrase the question in an organising way,so in the image attached by the question the error dynamics was
epsilon_dot= A(t)*epsilon so A(t)=[-L phi';lambda*phi 0],where L are my gains for the states x,y and theta so it is a 3x3 diagonal matrix and lambda is 2x2 diagonal matrix where lambda are the gains of slip estimation error so we have two wheels so it,s 2x2 ,phi is a 2x3 contains some information about is the system like the input and theta(t) that's why it is phi(t),and epsilon is vector of errors [e;eta_tilde] where e=[ex;ey;eth]and eta_tilde=[eta tilde_r;eta tilde_l] where eta tilde :slip error estimation so I want to solve for this dynamics to obtain L and lambda's that makes the error goes to zero as t tends to infinity,so For solving for L I decoupled the problem so I assume eta_tilde dot equal to zero so from the equations remaining edot =-L e It's a 3x3 matrix obtaining the eigenvalues det(sI-L) equal any desired eigenvalues where the desired eigenvalues are in the left side of the s-plane as now I got L I substituted the values of L in the big matrix where it is inside the image attached with the question ,such that L is known and phi(t) is known what is remaining lambda's so the matrix is 5x5 matrix,hope everything is clear now .thank you
That wall of text is difficult to read. It would be easier if you broke it up into pieces.
Dear walter roberson ,I will attach the problem in a latex code ,to make it more readable thank you

Hi @Ahmed Salem ,

However, I was curious and wanted to solve for the eigenvalues of the system matrix A(t) by implement the stability analysis in MATLAB by defining the variables (L, λ, φ(t)), construct the matrices (L, A(t)), and solve the characteristic equation. Below is a sample MATLAB code snippet to achieve this,

lambda1 = 1; % Example value for lambda1

lambda2 = 2; % Example value for lambda2

lambda3 = 3; % Example value for lambda3

lambda = 0.5; % Example value for lambda

phi_t = rand(2, 3); % Example time-varying matrix

After defining the variables, construct the A_t matrix using the defined variables:

L = diag([lambda1, lambda2, lambda3]);

A_t = [L, zeros(3, 2); lambda * phi_t, zeros(2, 2)];

Then, proceed with solving the characteristic equation for stability:

syms s

eqn = det(s*eye(5) - A_t) == 0;

lambda_values = solve(eqn, 'MaxDegree', 5);

disp(lambda_values); % Display the eigenvalues for stability

Please see attached results.

This will help you determine the eigenvalues that will ensure system stability.

Now, after going through attached pdf , this is what I understood by providing brief summary below.

The system dynamics are described by the matrix equation ε ̇ = A(t)ε, where A(t) is a matrix involving gains and system information. To simplify, assuming η ̇ = 0 reduces the system to e ̇ = −Le. Determining the matrix L involves choosing desired eigenvalues and forming L accordingly. The characteristic equation det(sI − L) = 0 helps in selecting stable eigenvalues. Substituting L back into A(t) yields the full system matrix. Stability is ensured by ensuring the eigenvalues of the matrix A(t) have negative real parts. This stability condition is met by solving det(sI − A(t)) = 0 with the given structure of A(t) to find the appropriate lambda values. I will start by assuming η ̇ = 0 to simplify the system to e ̇ = −Le, where L is a known matrix based on desired eigenvalues λ1, λ2, and λ3. So, I will define the matrix L using the desired eigenvalues:

L = diag([lambda1, lambda2, lambda3]);

Calculate the characteristic equation for L to ensure stability:

syms s

det(s*eye(3) - L) = 0;

Substitute the obtained L back into the original A(t) matrix to form a 5x5 matrix A(t) with λ as the variable:

syms lambda

A = [lambda, 1, 0, 0, 0; 0, lambda, 0, 0, 0; 0, 0, lambda, 0, 0; 0, 0, 0, lambda, 0;

phi(1,1), phi(1,2), 0, 0, lambda];

Solve for λ such that the eigenvalues of A(t) have negative real parts to ensure stability.

syms s

det(s*eye(5) - A) = 0;

Hope this helps resolve your problem. Please let me know if you have any questions.

Not sure if there is an answer that would be true for all phi(t) function. Do you have a particular system at hand that you want to analyze?
Agreed with @Aquatris and @Walter Roberson. Given , , , the analytical solution to find the scalar λ such that all eigenvalues have negative real parts may not exist for this 5th-order system, unless it is a very special case where there are repeating eigenvalues, even if the ϕ matrix is constant.
It should also be noted that there is only a single parameter, λ, that can be manipulated to obtain five eigenvalues with negative real parts. In other words, the problem has more degrees of freedom to be controlled than the number of independently controlled parameters.
I agree with comments, “ It should also be noted that there is only a single parameter, λ, that can be manipulated to obtain five eigenvalues with negative real parts” because this manipulation showcases the sensitivity of eigenvalues to changes in system parameters, highlighting the intricate relationship between system properties and eigenvalue behavior.
@Umar ,@Sam Chak λ is 2x2 diagonal matrix ,not a single parameter [λ4 0 ; 0 λ5] multiplied by phi(t) 2x3
@Ahmed Salem,
I was going to answer your question but @Sam Chak provided partial solution to evaluate the state matrix A at each time step t. Is this the solution you are seeking to solve for lambda's. Please advise.
Hi @Umar, you welcomed to provide your approach. It's a learning experience for everyone.
Since @Ahmed Salem know that the regressor matrix is bounded, certain range of values of can be selected to correspond with the maximum and minimum values of both and . No need to tediously evaluate for each time step t.
Dear @Sam Chak @Umar @Walter Roberson @Aquatris @Torsten I listened to your advices and an I managed to get solve for theta's in which the elements will be maximum or minimum rather than solving for eact time step ,if I used lambda's to be lambda=diag(2,2) and L=diag(5,2,3) ,according to the script which I will atach here system will be stable,so error converges to zero ,but when I TRY TO use these values in the simulink to simulate my model the error for the states goes to zero but for the estimated parameters not ,so why is that ?? thank you

Sign in to comment.

 Accepted Answer

The following is not a full solution, but it should provide an idea of how to evaluate the state matrix A at each time step t.
The idea is to obtain the characteristic polynomial of the 5-by-5 matrix A, and then from the coefficients of the characteristic polynomial, the tabular method may be applied to find λ (in symbolic form) based on the Routh–Hurwitz criterion.
However, it should be noted that the stability of a linear parameter-varying system of the form is not absolutely guaranteed, even if the system contains all eigenvalues with negative real parts at each time step t as t approaches .
If the 2-by-3 matrix is a relatively slowly time-varying, bounded matrix in the state matrix , then the system may be stable.
syms lambda1 lambda2 lambda3 lambda4 lambda5
syms phi [2 3]
L1 = diag([lambda1 lambda2 lambda3]);
L2 = diag([lambda4 lambda5]);
Z = zeros(2);
%% State matrix
A = [-L1, phi.'
L2*phi, Z]
A = 
%% Coefficients of the Characteristic polynomial
CP = charpoly(A)
CP = 

7 Comments

Hi @Sam Chak ,YES the phi(t) is my regressor matrix it is bounded and globally Lipschitz ,so of course the system may be stable . but I will try in this manner as you mentioned , to see the solution, each entry in phi(t) is bounded
I updated the proposed approach to address . However, I'm unsure whether it is or . Anyhow, it doesn't really matter, because the result from the Routh–Hurwitz criterion would allow to make some assumptions about such that all first-column elements of the Routh–Hurwitz table must have the same sign.
Although, Routh–Hurwitz criterion is a fundamental tool in control systems analysis but I will be careful when applying it because if any first-column element changes sign, the system is unstable especially considering stability of the system. So, I am not so sure about this alternative approach.
We are unfamiliar with your system and are uncertain about the details of how you ran the simulation in Simulink. However, based on the chosen lambda values and the information you provided, the system appears to be stable when running in MATLAB.
tspan = [0 300];
x0 = [1; 0.8; 0.6; 0.4; 0.2];
[t, x] = ode45(@ode, tspan, x0);
plot(t, x), grid on, xlabel('t')
legend('show')
function dx = ode(t, x)
% parameters
d = 0.574/2;
L = diag([5, 2, 3]); % Diagonal matrix L (3x3)
lambda = diag([2, 2]); % Diagonal matrix lambda (2x2)
v_R = 0.85;
v_L = 0.17;
% Time-varying 2-by-3 matrix
T = 10;
theta = 2*pi/T*t;
Phi = [-cos(theta)/2*v_R, -sin(theta)/2*v_R, -1/(2*d)*v_R
-cos(theta)/2*v_L, -sin(theta)/2*v_L, 1/(2*d)*v_L];
% State matrix
A = [-L, Phi';
-lambda*Phi, zeros(2,2)];
% The system
dx = A*x;
end
@Ahmed Salem,
@Sam Chak did a very good job by simulating the stability of system using ODEs, he did define the parameters of the system, such as d, L, lambda, v_R, and v_L, also calculated the time-varying matrix Phi based on the current time t. Finally, constructed the state matrix A using the parameters and matrices and his function does return the derivative of the state vector x, denoted by dx. The reason @Sam Chak used this equation below in his function because of his comments in the post, “Since @Ahmed Salem know that the regressor matrix is bounded” and try to tell you that Matlab is not causing any problems and prove the point about system stability by mentioning, “based on the chosen lambda values and the information you provided, the system appears to be stable”
Phi = [-cos(theta)/2*v_R, -sin(theta)/2*v_R, -1/(2*d)*v_R - cos(theta)/2*v_L, -sin(theta)/2*v_L, 1/(2*d)*v_L];
Now, going back to analyze the stability of your system, you first define the symbolic toolbox and set the parameters for the system, including the matrices L and lambda, as well as the velocities v_R and v_L. You then generate 100 critical points within the range [0, 2*pi] for theta using the linspace function. Next, you defined a function compute_Phi that computes the matrix Phi for a given theta, iterating over the critical points, calculate the eigenvalues of the system at each point, and store them in the eigenvalues matrix. After computing the eigenvalues, you check if all the real parts of the eigenvalues are less than zero to determine the stability of the system at the critical points. If all eigenvalues have negative real parts, the system is stable; otherwise, it is unstable. Then, you visualize the stability analysis by plotting the real parts of the eigenvalues for lambda and L separately. The plots show how the real parts of the eigenvalues vary with theta for both lambda and L matrices, providing insights into the system's stability characteristics. Finally, you computed the transpose of matrix A and calculate the matrix P as the sum of A and its transpose which further aid in understanding the system dynamics and properties. I took liberty to modify your code to visualize the stability analysis by plotting the real parts of the eigenvalues for lambda and L separately and the plots did show how the real parts of the eigenvalues vary with theta for both lambda and L matrices, providing insights into the system's stability characteristics and did little modification to observe if system was stable at all critical points, after Column 100, it displayed that Output size exceeded the limit and Displayed partial results but that was impressive that system was still stable system at all critical points even after iteration through Column 100. I can’t share the plots at this point since limited to 10 daily uploads.
% Plot stability based on real parts of eigenvalues for lambda
figure;
plot(theta_critical, real(eigenvalues(1:2, :)), 'LineWidth', 2); % Plot only the first two eigenvalues for lambda
xlabel('\theta');
ylabel('Real part of eigenvalues');
title('Stability Analysis of the System for Lambda');
legend('\lambda_1', '\lambda_2');
grid on;
% Plot stability based on real parts of eigenvalues for L
figure;
plot(theta_critical, real(eigenvalues(3:5, :)), 'LineWidth', 2); % Plot the remaining eigenvalues for L
xlabel('\theta');
ylabel('Real part of eigenvalues');
title('Stability Analysis of the System for L');
legend('\lambda_3', '\lambda_4', '\lambda_5');
grid on;
But you took these values and utilized them in the simulink to simulate your model which is an excellent approach to do analysis of system stability and improve it further but you observed that the error for the states goes to zero but for the estimated parameters not,
My only thoughts are that initial values are not close to the true values. In addition, parameters like convergence criteria, step size, and maximum iterations might impact the convergence behavior. So, you have to go through each block diagram by isolating from your complete model and do some debugging to isolate the problem. Hope this helps. This was quite intriguing problem to solve using advanced linear algebra concepts.
Hi @Umar Thank you for your feedback,yes the system is stable and Iam totally convinced ,but may be because iam trying to validate my observer with an experimental data which was taken till t=38 sec,so according to the plots that @Sam Chak provided using the intial conditions so it converges after nearly 150 sec, so I need to change the desired poles I used to get the gains for the states of the error ,so that I have to choose faster poles to speed up the convergenece of parameters error to zero ,over all I would like to thank you all.
Regarding observer design, it is generally necessary to ensure that the dynamics of the observer are 5 to 10 times faster than the system itself. However, in some nonlinear systems, a very fast observer can also destabilize the control structure. Therefore, it is important to find the appropriate balance and sweet spot for the observer dynamics.
If you find the proposed solution helpful, please consider clicking 'Accept' ✔ on the answer and voting 👍 for it. Your support is greatly appreciated!

Sign in to comment.

More Answers (0)

Asked:

on 30 Jul 2024

Commented:

on 1 Aug 2024

Community Treasure Hunt

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

Start Hunting!