0
$\begingroup$

When I solve the system of differential equations I get two solutions for each variable (See the picture). My question is how I can neglect one of the solutions at the plot (The yellow and the blue). Thanks.

Code:

sol=NDSolve[{3y[x]-0.5z[x]^2==y[x]*z'[x]^2(0.5+9y[x]),-y'[x]==y[x]*z'[x]^2+y[x]^2*z'[x]^2(18+4)-y[x]*y'[x]*z'[x]^2,y[0]==1,z[0]==0.2},{z,y},{x,0,60}];

Code for the plot:

Plot[Evaluate[{Sqrt[y[x]],z[x]}/.%],{x,0,60},PlotRange->All,PlotPoints->200]

Thnks.enter image description here

$\endgroup$
1
$\begingroup$

First I take your solution with smaller integration range:

sol = NDSolve[{3 y[x] - 0.5 z[x]^2 == y[x]*z'[x]^2 (0.5 + 9 y[x]), -y'[x] == 
y[x]*z'[x]^2 + y[x]^2*z'[x]^2 (18 + 4) - y[x]*y'[x]*z'[x]^2,y[0] == 1, z[0] == 0.2}, {z, y}, {x, 0, .5}]

sol contains two different solution pairs sol[[1]] and sol[[2]]

Plot[Evaluate[{Sqrt[y[x]], z[x]} /. sol[[1]]], {x, 0, 0.5}]

enter image description here

Plot[Evaluate[{Sqrt[y[x]], z[x]} /. sol[[2]]], {x, 0, 0.5}]

enter image description here

$\endgroup$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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