0

1.The function 'diff' seems could only work with one-element variable 'v'

diff(f,v); % f(v), v is a one-lelement variable 

while I would like do differentiation on a symbol matrix

diff(F, V); % F(V), V is a symbol matrix variable 

2.If I make differentiation to each element of the symbol matrix, and obtain the result of diff(F, V), while the result is in element by element format,

[g1(v_i), g2(v_i), ..., gn(v_i)] 

so I want to know are there some methods to make the result in symbol matrix variable format like this?

g(V)

3.for example

diff(x^T*A*x, x) = A^T*x + A*x; % A is a constant matrix, x is a vector
xychen
  • 31
  • 4

1 Answers1

0

I believe you are looking for jacobian.

Christopher Creutzig
  • 8,656
  • 35
  • 45
  • not exactly, the result of jacobian function of matlab is expanded like the 2th above. – xychen Mar 17 '13 at 07:30
  • Then I guess I misunderstood what you want to see. Is this a question on the output/display, or are you looking for how to get `g(V)` as the input for the derivative? – Christopher Creutzig Mar 17 '13 at 09:23
  • e.g. If the output of the jacobian of matlab is ans = [a11+b11, a12+b12; a21+b21, a22+b22] However, I want to obtain the output like this ans = A+B – xychen Mar 18 '13 at 02:00
  • Sorry, Symbolic Math Toolbox cannot do that (maybe in specific cases, but I cannot think of any). You could contact support@mathworks.com and suggest an enhancement, of course. – Christopher Creutzig Mar 18 '13 at 07:32