Using symbolic matrix operations correctly?
Ältere Kommentare anzeigen
I am new to symbolic computations in MATLAB and am trying out matrix differentiations.
If we take derivative of trace(X*A) w.r.t. X, we should get A^T.
But MATLAB tells me
>> syms X A;
>> diff(trace(X*A), X)
ans =
A
Where am I wrong?
Akzeptierte Antwort
Weitere Antworten (2)
Andrei Bobrov
am 27 Jul. 2016
reshape(jacobian(trace(A.*X),X(:)),size(A))
Azzi Abdelmalek
am 27 Jul. 2016
A is not defined as a symbolic matrix.
A=sym('a',5)
syms x
diff(trace(x*A),x)
Kategorien
Mehr zu Operations on Strings finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!