필터 지우기
필터 지우기

Solving an equation with symbolic matrix

조회 수: 3 (최근 30일)
Juan Ignacio Peña
Juan Ignacio Peña 2024년 2월 20일
편집: Torsten 2024년 2월 20일
I've tried solving eq1 in the following program.
The right answer is w = -D*lambda*unos
%start
unos=ones(2,1)
unos = 2×1
1 1
ceros=zeros(2,1)
ceros = 2×1
0 0
E = symmatrix('E',2)
E = 
D=inv(E)
D = 
w=symmatrix('w',[2,1])
w = 
eq1= w + D*lambda*unos==ceros
Unrecognized function or variable 'lambda'.
solve(eq1,w)
%end
The right answer is w = -D*lambda*unos
But instead, I get the following message:
Check for incorrect argument data type or missing argument in call to function 'solve'.
Please help

답변 (1개)

Torsten
Torsten 2024년 2월 20일
  댓글 수: 4
Juan Ignacio Peña
Juan Ignacio Peña 2024년 2월 20일
Thank you, Torsten. I am interested in working with matrices as whole variables. I mean, considering matrices or vectors of generic size and with given assumptions (like symmetric, positive definite, etc), but without knowing the exact dimensions and elements. In my example, D is the inverse of a symmetric matrix, and I'm looking for the answer in terms of the matrix and not its elements.
As far as I understand, symmatrix2sym(D) converts a symbolic matrix variable D to an array of symbolic scalar variables S. I'm not interested in the elements of D. I am interested in working with D as a specific variable (of any dimension).
Torsten
Torsten 2024년 2월 20일
편집: Torsten 2024년 2월 20일
Ok, then it doesn't seem possible in MATLAB.

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

카테고리

Help CenterFile Exchange에서 Symbolic Variables, Expressions, Functions, and Preferences에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by