Solving an equation with symbolic matrix

6 views (last 30 days)
Juan Ignacio Peña
Juan Ignacio Peña on 20 Feb 2024
Edited: Torsten on 20 Feb 2024
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

Answers (1)

Torsten
Torsten on 20 Feb 2024
  4 Comments
Juan Ignacio Peña
Juan Ignacio Peña on 20 Feb 2024
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 on 20 Feb 2024
Edited: Torsten on 20 Feb 2024
Ok, then it doesn't seem possible in MATLAB.

Sign in to comment.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!