Changing the derivative variable in symbolic matlab
조회 수: 3 (최근 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!