Symbolic Math Error using diff

4 ビュー (過去 30 日間)
Carlas
Carlas 2013 年 11 月 3 日
編集済み: Carlas 2013 年 11 月 3 日
Hi All,
I was wondering why it is not possible to do the following
x = sym('x',[2 1]); A = sym('A',[2 2]);
diff(x'*A*x,'x')
ans = 0
Is there an alternative method to preform this differentiation?
Thanks
  1 件のコメント
Carlas
Carlas 2013 年 11 月 3 日
編集済み: Carlas 2013 年 11 月 3 日
gradient(x'*A*x,x) gives the requested result ans =
A1_1*x1 + A1_2*x2 + A1_1*conj(x1) + A2_1*conj(x2)
A2_1*x1 + A2_2*x2 + A1_2*conj(x1) + A2_2*conj(x2)
Does anyone know a way to get the result in matrix form again: (A+A')x

サインインしてコメントする。

採用された回答

sixwwwwww
sixwwwwww 2013 年 11 月 3 日
Dear Carlas, you can try something like this:
x = sym('x%d',[2 1]);
A = sym('A%d%d',[2 2]);
x1 = diff(x' * A * x, x(1));
x2 = diff(x' * A * x, x(2));
I hope it helps. Good luck!

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by