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!