Changing the derivative variable in symbolic matlab
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Aghamarsh Varanasi
2021-5-27
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!