how to speed up calculation
1 次查看(过去 30 天)
显示 更早的评论
I have two pig matrices of size 18 x 18,D and C with so long symbolic elements. they are used as the coeffiecient of a differential equation of the form D(q)qdotdot+C(q,qdot)qdot+G(q)=tau; q is of size 18x1 variables the problem that i have is each time step of ode45 for solving this ODE takes more than one minutes (some elements of D and C sre so huge). can any body please give me a solution to reduce the time. the ode is actually useless with so much taking time thank you
0 个评论
回答(2 个)
Jarrod Rivituso
2011-4-5
Have you tried another solver besides ode45? For instance, ode15s is helpful for stiff systems, and according to the documentation can be used "If ode45 is slow because the problem is stiff".
Check out the table in the documentation:
>> doc ode45
0 个评论
John D'Errico
2011-4-5
So, don't make them symbolic matrices! If you are simply substituting numbers into them anyway to drive an ODE solver, making them symbolic seems silly. And if you need them in symbolic form for other things, then create a non-symbolic form for the matrices.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!