Using symbolic matrix operations correctly?
显示 更早的评论
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?
采纳的回答
更多回答(2 个)
Andrei Bobrov
2016-7-27
reshape(jacobian(trace(A.*X),X(:)),size(A))
Azzi Abdelmalek
2016-7-27
A is not defined as a symbolic matrix.
A=sym('a',5)
syms x
diff(trace(x*A),x)
类别
在 帮助中心 和 File Exchange 中查找有关 Operations on Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!