I'm trying to graph the phase plane of the following nonlinear system in Mathematica using NDSolve, and `VectorPlot_.
dx/dt = y
dy/dt = x - y + x ^ 3
And this is my
graph1 = VectorPlot[{y, x - y + x^3}/(1 + (y)^2 + (x - y + x^3)^2)^0.5, {x, -10,
10}, {y, -10, 10}];
gensol[x0_, y0_] :=
NDSolve[{x'[t] == y[t], y'[t] == x[t] - y[t] + x[t]^3, x[0] == x0,
y[0] == y0}, {x[t], y[t]}, {t, -10, 10}];
sol[1] = gensol[4, 0];
sol[2] = gensol[0, 0];
sol[3] = gensol[0, 0];
sol[4] = gensol[0, 0];
sol[5] = gensol[0, 0];
graph2 = ParametricPlot[
Evaluate[Table[{x[t], y[t]} /. sol[i], {i, 5}]], {t, -10, 10},
PlotRange -> {{-10, 10}, {-10, 10}}];
Show[{graph1, graph2}]
But I keep getting this error, and I can't seem to get rid of it.
I've removed the ^3 from the x and then it worked just fine, so I'm not seeing how re-adding back in the ^3 would cause it to stop working.
And no matter what initial conditions I input it keeps repeating the same errors.
NDSolve::ndsz: At t == -0.441719, step size is effectively zero; singularity or stiff system suspected. >>
NDSolve::ndsz: At t == 0.470765016687473`, step size is effectively zero; singularity or stiff system suspected. >>
InterpolatingFunction::dmval: Input value {-9.99959} lies outside the range of data in the interpolating function. Extrapolation will be used. >>
InterpolatingFunction::dmval: Input value {-9.99959} lies outside the range of data in the interpolating function. Extrapolation will be used. >>
Any ideas how to fix it?
