I'm trying to design a parametric plot to model the effects of changing parameters on this ODE, but the plot keeps coming up completely empty. Any ideas about what's going on?


enter image description here

sol = DSolve[{y'[x] == y[x] (i p - r - i y[x])}, y[x], x]

With[{expr = {y[t]} /. sol}, 
ParametricPlot[expr, {t, 0, 5}, 
PlotRange -> {{0, 100}, {0, 100}}], {{p, 0}, 0, 50}, {{i, 0}, 0, 
50}, {{r, 0}, 0, 50}]]

edit:added copyable code

  • $\begingroup$ Please use copyable code instead of posting an image. $\endgroup$ Commented Aug 11, 2017 at 15:00
  • $\begingroup$ edited in copyable code $\endgroup$
    – user51632
    Commented Aug 11, 2017 at 15:06
  • 2
    $\begingroup$ ParametricPlot[] is intended for parametric equations, and you do not have a parametric equation. Also, you give no initial conditions for your DE, so it can't evaluate to a number and thus be plotted. $\endgroup$ Commented Aug 11, 2017 at 15:08
  • $\begingroup$ Darn. I know how to put in initial conditions, but do you have any advice on what type of plot I should use? I basically just want to visually compare the effects of changing the parameters. This could be in the form of many lines, or a parametric plot like this, or something I haven't thought of yet. Thanks! $\endgroup$
    – user51632
    Commented Aug 11, 2017 at 15:12
  • $\begingroup$ Have you tried Plot[]? $\endgroup$ Commented Aug 11, 2017 at 15:16

1 Answer 1


Based on J.M. remarks, and adding the constant C[1], which depends on the initial condition, as a variable alpha, this should do what you are looking for:

(* note the use of `DSolveValue` instead of `DSolve`, and the replacement rule *)
sol = DSolveValue[{y'[x] == y[x] (i p - r - i y[x])}, y[x], x] /. C[1] -> alpha
expr[p_, i_, r_, alpha_] := Evaluate@sol

   Plot[expr[p, i, r, alpha], {x, 0, 5}, PlotRange -> Full], 
   {{p, 0}, 0, 50}, {{i, 0}, 0, 50}, {{r, 0}, 0, 50}, {alpha, -10, 10}

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.