2
$\begingroup$

I am trying to solve the following system of differential equations:

eqn1 = m1 x1''[t] + k1 (x1[t] - x2[t]) + c1 (x1'[t] - x2'[t]) == 0;
eqn2 = m2 x2''[t] + k1 (x2[t] - x1[t]) + c1 (x2'[t] - x1'[t]) + k2 (x2[t]) + c2 (x2'[t])
==c2*(1.09013 Cos[Pi*13.88*t]) + k2*(0.025 Sin[Pi*13.88*t]);

To solve them I am using the following code for NDSolve:

ivals = {x1[0] == 0, x1'[0] == 0, x2[0] == 0, x2'[0] == 0};
soln = NDSolve[{{eqn1, eqn2}, ivals}, {x1[t], x2[t]}, {t, 0, 10}];

When I try to solve this I get the following error message:

NDSolve::ndnum: Encountered non-numerical value for a derivative at t == 0

And I don't understand why.

I would very much appreciate some help.

$\endgroup$
  • 1
    $\begingroup$ Try another set of initial conditions; right now x1[t]=x2[t]=0 is a solution. $\endgroup$ – chris Apr 6 '14 at 18:27
2
$\begingroup$

I am not sure if this answers your question but…

eqn1 = x1''[t] == - (x1[t] - x2[t]) - (x1'[t] - x2'[t]);
eqn2 = x2''[t] == -k1 (x2[t] - x1[t]) - (x2'[t] - x1'[t]) + - (x2[t]);

Then

 ivals = {x1[0] == 1, x1'[0] == 0, x2[0] == 1, x2'[0] == 0};
 sol = DSolve[Flatten@{{eqn1, eqn2}, ivals} // Evaluate, {x1[t], x2[t]}, t]

works…

So would this if you want symbolic m1,m2,c1,c2

eqn1 = m1 x1''[t] == - k1 (x1[t] - x2[t]) - c1  (x1'[t] - x2'[t]);
eqn2 = m2 x2''[t] == -k1 (x2[t] - x1[t]) -  c2 (x2'[t] - x1'[t]) + - (x2[t]);
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.