Solving an equation with symbolic matrix

5 次查看(过去 30 天)
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