Solve a variable and then the second order differential equation (ODE45)
Show older comments
Hello,
I have my dynamic equation M*q'' +C*q'+g=Tau and I created a program using ODE45 to solve q and q' as follows:
qinit=[0;0;0]; % q(0), q'(0) and q''(0)
[t,y] = ode45(@EQM,[0,1],qinit);
function dqdt = EQM(t,q)
Tau=M*q(3) +C*q(2)+g;
dqdt=[q(2);M^-1(Tau-C*q(2)-g)]
But in ode45 the vector returned by ODE function (EQM) and the initial conditions vector (qinit) must have the same number of elements.
What can I do if I need to solve my EQM having a q'' initial condition?
Thanks in advance!
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!