1
$\begingroup$

I am trying the following:

Plot[DSolve[{1220*x''[t] + 1000*x'[t] + 35600 x[t] + 4500*x[t]^3 + 
     2135 == 0, x[0] == 0, x'[0] == -5}, x, t], {t, 0, 10}]

Could someone please point me in the right direction? I am just getting the same input if I just try:

DSolve[{1220*x''[t] + 1000*x'[t] + 35600 x[t] + 4500*x[t]^3 + 
     2135 == 0, x[0] == 0, x'[0] == -5}, x, t]

I have used Mathematica to solve these kinds of equations before but I'm drawing a blank here. It's just the good ol' mass-spring-damper system.

$\endgroup$
7
  • $\begingroup$ If DSolve cannot solve the DE, which seems to be the case, you can use NDSolve to get a solution that you can plot. Would that be okay, or do you need the symbolic solution? $\endgroup$
    – Michael E2
    Apr 12 '15 at 23:13
  • $\begingroup$ NDSolve gives me: x[t] -> Interpolating function. I just really need to plot it. A symbolic solution would be nice, but not necessary. $\endgroup$
    – Lucif3r
    Apr 12 '15 at 23:18
  • $\begingroup$ Yep. The documentation shows examples of plotting the result. Does that work? $\endgroup$
    – Michael E2
    Apr 12 '15 at 23:19
  • $\begingroup$ Mmmm.. I can't seem to get it to work. I'll fiddle with it some more. I have never seen said output. Mathematica rookie :) $\endgroup$
    – Lucif3r
    Apr 12 '15 at 23:27
  • $\begingroup$ It's just the good ol' mass-spring-damper system. Well, it is a special spring you have and not the good old one. You have non-linear spring, so this makes it hard to find closed form solution. Are you saying Mathematica solved this analytically before? $\endgroup$
    – Nasser
    Apr 12 '15 at 23:30
0
$\begingroup$

You can use NDSolveValue:

ClearAll[xfunc1, x, t]
xfunc1 = NDSolveValue[{1220*x''[t] + 1000*x'[t] + 35600 x[t] + 
      4500*x[t]^3 + 2135 == 0, x[0] == 0, x'[0] == -5}, x, {t, 0, 10}];
Plot[xfunc1[t], {t, 0, 10}]

enter image description here

Or use NDSolve and ReplaceAll to get the solution function:

ClearAll[xfunc2, x, t]
xfunc2 =  x /. NDSolve[{1220*x''[t] + 1000*x'[t] + 35600 x[t] + 
         4500*x[t]^3 + 2135 == 0, x[0] == 0, x'[0] == -5}, x, {t, 0, 10}][[1]];

Plot[xfunc2[t], {t, 0, 10}]
(* same picture *)
$\endgroup$
0
0
$\begingroup$

Use NDSolve

sol = NDSolve[{1220*x''[t] + 1000*x'[t] + 35600 x[t] + 4500*x[t]^3 + 2135 == 0,
               x[0] == 0, x'[0] == -5}, x, {t, 0, 10}];

Plot[Evaluate[x[t] /. sol], {t, 0, 10}, PlotRange -> All]

enter image description here

$\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.