Changing the derivative variable in symbolic matlab
3 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Aghamarsh Varanasi
on 27 May 2021
Hi,
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
0 Comments
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!