second-order ODE, convert symbolic representation into matlabFunction
1 次查看(过去 30 天)
显示 更早的评论
Hi!
I my code a symbolic second order ODE is created. Because i want to solve the function with ode45 i transform the ODE into a system of first order ODEs.
All that works.
But: If the complexity an length of the ODE increases matlab takes a HUGE (up to hours) time to do "matlabFunction".
Here is the relevant part of my code([ ] is only explanation):
x = sym('x%d',[n,1]);
x = sym(x,'real');
xdot = sym('xdot%d',[n,1]); %
xdot = sym(xdot,'real');
xddot = sym('xddot%d',[n,1]); %
xddot = sym(xddot,'real');
[...some stuff happens here]
xddot=[f(x1,x2,x3,....,xdot1,xdot2,xdot3,...] %<- something like that
func=matlabFunction(xddot,'vars',{'t',[x;xdot]}); %<- slow!
any suggestions how to speed up things a little bit?
Greetings Alex
0 个评论
回答(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!