How to speed up my code (computing jacobian)
조회 수: 4 (최근 30일)
이전 댓글 표시
My input are a lot of linear expressions such as x1+x2, x2+3*x3 etc. How to speed up my code as follows
allvars = symvar(input); % There are about 1000 LINEAR expressions in 'input'
J = jacobian(input, allvars);
댓글 수: 1
Torsten
2024년 6월 15일
You shouldn't work symbolically with about 1000 expressions. A numerical approach is the way to go.
채택된 답변
Matt J
2024년 6월 15일
편집: Matt J
2024년 6월 15일
You can use equationsToMatrix to obtain the Jacobian. Depending on what you are doing, you might then convert the matrix to double so you can reuse and do more rapid numerical manipulations with it.
댓글 수: 1
추가 답변 (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!