How to tell solver that symbols are matrices
Mostra commenti meno recenti
Hi,
I want to solve an equation which involves matrices. I could not tell matlab the variables are matrices. I need something like
a=matrix(a,[n1,n2]);
b=matrix(b,[n3,n4]);
where n1 n2 n3 n4 are dimensions of matrices then I want to solve
solve(a+b*a^2==2b,a) (This equation is not the real equation, my equation is very long and I have more than a and b variables (lots of variables)
a and b are symbolic meaning
syms a b
Thanks
Risposta accettata
Più risposte (1)
John D'Errico
il 2 Mag 2021
Modificato: John D'Errico
il 2 Mag 2021
A = sym('a',[2,2])
As you can see, A is a 2x2 matrix.
B = rand(2,2);
X = rand(2,2);
Asol = solve(A*X == B,A)
So now, for example, we see a1_1 is
Asol.a1_1
Categorie
Scopri di più su Assumptions in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
