Changing the derivative variable in symbolic matlab

3 visualizaciones (últimos 30 días)
Nethanel Benzaquen
Nethanel Benzaquen el 4 de Mayo de 2021
Respondida: Aghamarsh Varanasi el 27 de Mayo de 2021
How can i preform the derivative of a symbolic Matrix in repect to every variable in the equation
in other words: if i have a symbolic Matrix (3x3) which in a function of x1,x2,x3...
how can i calculate dM(1,1)/dx1,dM(1,1)/dx2,dM(1,1)/dx3,...dM(1,2)/dx1,dM(1,2)/dx2,... etc.
just to clarify the matrix M is a symbolic matrix and x1,x2,x3... are symbolic varibles.
Thanks in advance.

Respuestas (1)

Aghamarsh Varanasi
Aghamarsh Varanasi el 27 de Mayo de 2021
If the symbolic matrix be stored in a variable 'M', the function 'diff' can be used to get the partial derivative of the matrix 'M'. For Example, M is a Symbolic Matrix of symbolic variables x1, x2 and x3.
Mdx1 = diff(M,x1);
This will give the partial differential of the matrix with respect to x1 i.e, Mdx1(1,1) = dM(1,1)/dx1, Mdx1(1,2) = dM(1,2)/dx1 etc.
You can similarly partially differentiate the matrix 'M' with respect to other symbolic variables x2 and x3.
Hope this helps


Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.


Community Treasure Hunt

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

Start Hunting!

Translated by