how to solve the equation: Exdot=AX+Bu; with E is a singular matrix ? thank you

3 Ansichten (letzte 30 Tage)
Exdot=AX+Bu; with E is a singular matrix ?

Antworten (1)

Sam Chak
Sam Chak am 2 Feb. 2023
Bearbeitet: Sam Chak am 2 Feb. 2023
If your system is linear, then try using dss() command. See example below:
If the system are nonlinear, then you need to specify 'MassSingular' and 'maybe', or 'yes' in the odeset().
A = [0 1; -1 -2]
A = 2×2
0 1 -1 -2
B = [0; 1]
B = 2×1
0 1
C = [1 0]
C = 1×2
1 0
D = 0;
E = [2 4; 4 8]
E = 2×2
2 4 4 8
rank(E) % Rank of matrix E is less than 2
ans = 1
inv(E)
Warning: Matrix is singular to working precision.
ans = 2×2
Inf Inf Inf Inf
% Descriptor state-space system
sys = dss(A, B, C, D, E)
sys = A = x1 x2 x1 0 1 x2 -1 -2 B = u1 x1 0 x2 1 C = x1 x2 y1 1 0 D = u1 y1 0 E = x1 x2 x1 2 4 x2 4 8 Continuous-time state-space model.
% Step Response
step(sys)
  2 Kommentare
John D'Errico
John D'Errico am 2 Feb. 2023
Bearbeitet: John D'Errico am 2 Feb. 2023
A comment: Do not test for singularity using det. This is simply a bad idea, and one that should NEVER be recommended to others, as that only propagates a terrible idea. Yes, teachers teach it. But they had to learn from someone else. And every time someone propagates a bad idea, it gets further entrenched in the minds of those who will read what you write.
If you want to test for a matrix being numerically singular, then use rank, or cond. If the condition number is sufficiently large (the limiting value depends on whether the matrix is single or double), then it is singular. If rank(A) is smaller than min(size(A)), then the array A is numerically singular.
If you don't believe me, then a simple example may suffice. Is the matrix A singular?
A = eye(1200);
Is the matrix B singular?
B = A/2;
Finally, is the matrix C singular?
C = A*2;
Surey you would agree that all are perfectly well behaved matrices, and as far from being singular as you could imagine. Test each of them using det.
det(A)
ans = 1
det(B)
ans = 0
det(C)
ans = Inf
Note that det(B) is returned as an EXACT zero. Not even just a small number.
det(B) == 0
ans = logical
1
And these are not the only reasons why det is a bad method to employ.
Remember that those who you will teach today will be teaching others tomorrow.
Sam Chak
Sam Chak am 2 Feb. 2023
Thank you @John D'Errico. I had a 'bad' math teacher in Grade 9. 😅

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Sparse Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by