Transform or eliminate states of mechss object

조회 수: 2 (최근 30일)
Luuk Poort
Luuk Poort 2021년 9월 30일
댓글: Luuk Poort 2021년 10월 5일
Dear MATLAB community,
I have a mechss object and I want to fix several states by removing these columns and rows from the system matrices.
However, I encounter the issue that I cannot change the system matrices one by one as this violates the constraints that the system matrix dimensions should coincide.
For first order systems, this issue is circumvented by using the modred function, but this is not applicable to mechss objects.
Can I eliminate states of the system matrices, without having to redefine to redefine the mechss object?
Thank you!

채택된 답변

Paul
Paul 2021년 10월 5일
Even garden variety ss objects can't have the system matrices changed one by one
sys = rss(4,2,2) % model with four states, two inputs, two outputs
sys = A = x1 x2 x3 x4 x1 -8.754 -1.154 -3.312 2.16 x2 0.5769 -0.229 2.056 5.137 x3 -2.491 -2.232 -1.25 2.006 x4 3.229 -4.963 -0.1344 -1.076 B = u1 u2 x1 0 1.129 x2 -0.7629 0.8949 x3 0 -1.235 x4 -1.278 1.064 C = x1 x2 x3 x4 y1 0 -1.351 -1.069 0.9355 y2 0.01518 1.068 0 -0.897 D = u1 u2 y1 -1.096 0 y2 0.9333 0 Continuous-time state-space model.
% sys.a = sys.a(1:3,1:3); % attempt to eliminate the fourth state from A, results in an error
Instead, use set to eliminate the fourth state by changing all the matrices at once:
set(sys,'a',sys.a(1:3,1:3),'b',sys.b(1:3,:),'c',sys.c(:,1:3));
sys
sys = A = x1 x2 x3 x1 -8.754 -1.154 -3.312 x2 0.5769 -0.229 2.056 x3 -2.491 -2.232 -1.25 B = u1 u2 x1 0 1.129 x2 -0.7629 0.8949 x3 0 -1.235 C = x1 x2 x3 y1 0 -1.351 -1.069 y2 0.01518 1.068 0 D = u1 u2 y1 -1.096 0 y2 0.9333 0 Continuous-time state-space model.
Maybe a similar approach will work for a mechss object.
  댓글 수: 1
Luuk Poort
Luuk Poort 2021년 10월 5일
Hi Paul,
Thank you very much for this answer, it indeed also works for mechss models!
In my implementation, where I extended the mechss class, I was also able to acces the Data_ property, which contains all system matrices and thus I could change all system matrices simultaneously. Your method however is much more intuitive and versatile, so thank you!
Best, Luuk

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Plot Customization에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by