I have a state space system with a Cn matrix
Cn = [1.318e+5 0 0 0;0 0 1.318e+5 0]
and I need to transform it to a C matrix like
C = [1 0 0 0; 0 0 1 0]
The transformation can be made using the following: A = M*An*inv(M), B = M*Bn, C = Cn*inv(M)
I tried to use linsolve(C,Cn) to get my M matrix, which "works" ang gives me
M =
131800 0 0 0
0 0 0 0
0 0 131800 0
0 0 0 0
But this matrix M is non-invertible and the multiplication Cn*inv(M) returns a matrix of NaN values. I know that:
M =
131800 0 0 0
0 1 0 0
0 0 131800 0
0 0 0 1
is invertible and works perfectly for me in this case, but I can't find a way to calculate this M on Matlab.
Can I force the result of a linsolve to be invertible or is there another way to calculate this M so it gives me the one I desire?

 채택된 답변

John D'Errico
John D'Errico 2018년 5월 24일
편집: John D'Errico 2018년 5월 24일

1 개 추천

NO. You cannot force linsolve to return the solution you wish to see for a non-invertible matrix. At least not without doing some moderate linear algebra of your own to reduce the dimension of the problem. But if you knew how to do that, you would not be asking how to use linsolve here.
You can use a tool that is designed to survive on singular problems.
pinv(Cn)*Cn
ans =
1 0 0 0
0 0 0 0
0 0 1 0
0 0 0 0

댓글 수: 3

João Filipe Silva
João Filipe Silva 2018년 5월 25일
Oh, ok. Thanks!
But, since the matrix M has to be invertible to work on the other matrix transformations (A = M*An*inv(M), B = M*Bn), is there a way to find a M matrix that obeys the Cn -> C transformation and then test it for one of the others? Like a trial and error?
The paper I'm reading just gives me this M matrix, saying that it came from the Cn -> C transformation, but not how he actually calculated it.
Trial and error? Seriously?
d = sum(Cn,1);
d(d == 0) = 1;
M = diag(d);
M
M =
131800 0 0 0
0 1 0 0
0 0 131800 0
0 0 0 1
Since you have not told me anything significant about what your expectations for Cn might be, that is about as good as I can do.
João Filipe Silva
João Filipe Silva 2018년 5월 25일
편집: João Filipe Silva 2018년 5월 25일
Well, thanks. I found out what was missing. There was a hidden conversion of coordinates that solved it all. But I'm thankful to have learned that I can't force a linsolve solution, and that a "trial and error" method will be shunned right away as a bad option.
Peace.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by