How to extract the "coefficients" of a symbolic matrix?

조회 수: 9 (최근 30일)
TRI
TRI 2023년 3월 23일
댓글: TRI 2023년 3월 25일
Given a symbolic square matrix y (Matlab code: syms y [n n] matrix;), for a symbolic matrix of the form y+Ay+yB+CyD+EyF+... (where A, B, C, D, E, F... are numerical matrix), how to separate the numerical matrices such as matrices A, B, C, D, E, F... through Matlab?
Example:
syms y [3 3] matrix;
A=randi(2,3,3);
B=randi(2,3,3);
C=randi(2,3,3);
D=randi(2,3,3);
x=y+A*y+y*B+C*y*D
run the code and then I got:
y*symmatrix([2,1,1;2,1,1;1,1,1]) + symmatrix([2,2,1;1,2,2;2,2,2])*y + symmatrix([1,1,2;1,1,1;1,2,2])*y*symmatrix([2,2,2;2,2,1;1,1,1]) + y
Then my question is: give the x=f(y) like above,how do I get all the matrices where y is multiplied by left and right?
I looked up the functions in the Symbolic Math Toolbox and Googled related questions, unfortunately all I could find was about the coefficients of symbolic polynomials or other expressions, and the "coefficients" of symbolic matrices were hard to find relevant answers.
I would appreciate it if you could help me.
  댓글 수: 1
Paul
Paul 2023년 3월 23일
I thought we might be able to get there with children, but I was wrong
syms y [3 3] matrix;
A=randi(2,3,3);
B=randi(2,3,3);
C=randi(2,3,3);
D=randi(2,3,3);
x=y+A*y+y*B+C*y*D
x = 
children(x)
Incorrect number or types of inputs or outputs for function 'children'.

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

답변 (1개)

Steven Lord
Steven Lord 2023년 3월 23일
Let's simplify the problem a bit and see if we can solve this for the expression z = y + A*y + y*B. What happens if either A or B commute with y? Then we could write this as (if A commutes with y) z = y + y*A + y*B which simplifies to z = y*(I+A+B). How would you determine unique matrices A and B that generate your result z? The answer is you don't, not without more information or making an arbitrary choice (like A is the identity I which is guaranteed to commute with y.)
For the 1-D case see this post on Cleve Moler's blog. In Cleve's impossible problem we're trying to find A and B that satisfy 3 = A*(1/2)+(1/2)*B. Obviously (1/2) commutes with both A and B so "the" solution is not unique.
So do you have more information about or constraints on your A, B, C, D, etc. matrices?
  댓글 수: 1
TRI
TRI 2023년 3월 25일
Unfortunately, the problem I need to deal with with matlab is that X is just a general symbolic matrix, generally non-commutative, with no exact numeric characteristics

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

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by