0
$\begingroup$

I am trying to solve a set of differential equations but keep getting an error. See message below

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

The system that I am trying to solve is the following:

e=.16 
g=.4 
w=.97 

I set it up as follows:

sol=NDSolveValue[{y1'[t]==y2[t],y2'[t]==-((2/L[t]) L'[t]+g L[t]) y2[t]-(1/L[t]) Sin[y1[t]],L'[t]==7 e w Sin^6[w t+9 pi/8] Cos[w t+ 9 pi/8],y1[0]==-1,y2[0]==1},y1[t],y2[t],L[t]},{t,0,30}] 

ParametricPlot[{y1[t],y2[t]},{t,0,30},AxesLabel->{"y1[t]","y2[t]"}]
$\endgroup$
3
  • $\begingroup$ hi, user41071, can you check the line with NDSolve? It doesn't seem correct to me, but I didn't want to edit it and get it completely wrong. $\endgroup$
    – mgm
    Jun 17, 2016 at 9:10
  • 1
    $\begingroup$ It should also be NDSolveValue instead of NDSolvevalue. Note the capital "V". $\endgroup$
    – Lukas
    Jun 17, 2016 at 9:15
  • $\begingroup$ hi, user41071, you forgot a initial condition for L[t]. $\endgroup$ Jun 17, 2016 at 9:18

1 Answer 1

1
$\begingroup$
e = .16;
g = .4;
w = .97;

You must add a initial condition, assume: L[0]=1

sol = NDSolveValue[{y1'[t] == y2[t], 
y2'[t] == -((2/L[t]) L'[t] + g L[t]) y2[t] - (1/L[t]) Sin[y1[t]], 
L'[t] == 7 e w Sin[w t + 9 Pi/8]^6* Cos[w t + 9 Pi/8], 
y1[0] == -1, y2[0] == 1, L[0] == 1}, {y1, y2, L}, {t, 0, 30}];

ParametricPlot[{sol[[1]][t], sol[[2]][t]}, {t, 0, 30}, 
AxesLabel -> {"y1[t]", "y2[t]"}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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