# Plot 3D for ODE

So I am trying to Plot3D this first-order ODE:

$$y'(x) = y$$

with the 3d coordinates (x,y,y'). I have read the documentation in Mathematica about 3DPlot and tried to "transfer" what I learned from there but it did not work. Any help would be really appreciated. Thanks!

• Have you already seen ParametricPlot3D[]? May 27 '20 at 15:14
• I just read it now, and I tried several things but it still has not worked out for me yet even though I feel like I have an idea after reading it. May 27 '20 at 16:10
• Clear["Global*"]; sol[y0_] = DSolve[{y'[x] == y[x], y[0] == y0}, y, x][[1]]; ParametricPlot3D[{x, y[x], y'[x]} /. sol[1], {x, -3, 2}] May 27 '20 at 16:17

ClearAll[ndsv]
ndsv[iv_?NumericQ] := NDSolveValue[{y'[x] == y[x], y[0] == iv}, {# &, y, y'}, {x, 0, 10}]

ParametricPlot3D[Evaluate[Table[Through@ndsv[iv]@t, {iv, 0, 3, .5}]], {t, 0, 10},
BoxRatios -> 1, PlotLegends -> LineLegend[Range[0, 3, .5], LegendLabel -> "y[0]"]]


ParametricPlot3D[Through@ndsv[u]@t, {t, 0, 10}, {u, 0, 3},
MeshFunctions -> {#5 &},
Mesh -> {MapIndexed[{#, Directive[Thick, ColorData[97][#2[[1]]]]} &, Range[0, 3, .5]]},
BoxRatios -> 1, PlotStyle -> Opacity[.5, Blue],
Method -> "BoundaryOffset" -> False, Lighting -> "Neutral",
PlotLegends -> LineLegend[97, Range[0, 3, .5], LegendLabel -> "y[0]"]]


• Can we somehow "connect" all the line together so that the plot becomes like a smooth and continuous surface? May 27 '20 at 16:11
• @TuanDucVu, please see the update.
– kglr
May 27 '20 at 21:08
• It seems like I have to learn quite a few more things in order to fully understand your code up there -- any suggestion would be appreciated --, but anyhow this is what I'm looking for. Thanks! May 27 '20 at 21:23
• @TuanDucVu, my pleasure. Thank you for the accept. And welcome mma.se.
– kglr
May 27 '20 at 21:29
Clear["Global*"];
sol[y0_] = DSolve[{y'[x] == y[x], y[0] == y0}, y, x][[1]];

Show[
ParametricPlot3D[
{x, y[x], y'[x]} /. sol[y0],
{x, -3, 2}, {y0, 0, 5},
PlotStyle -> Opacity[0.8],
Mesh -> None],
ParametricPlot3D[Evaluate@
Table[{x, y[x], y'[x]} /. sol[y0], {y0, 5, 0, -1}],
{x, -3, 2},
PlotLegends -> LineLegend[Automatic, Range[5, 0, -1],
LegendLabel -> y[0]]],
AxesLabel -> (Style[#, 14, Bold] & /@ {x, y[x], y'[x]}),
BoxRatios -> {1, 1, 1}]