Plot a solution of a differential equation

Consider a BVP $$x^{\prime\prime}(t)+x^{\prime2}(t)-x(t)\left(x^{2}(t)-\frac{3}{2}x(t)+\frac{1}{2}\right)=0,$$. The Boundary conditions are $$x(0)=1$$ and $$x(1)=2$$. It follows that the exact solution is $$x(t)=t^{2}$$, $$0\leq t\leq 1$$. How I plot this solution for t and f(t) (t=0.1,0.2,0.3,...0.9)

• If $x(t)=t^2$ then $x(1)=1$ and not $2$ and $x(0)=0$ not $1$
– bmf
Commented Apr 2, 2022 at 19:47
• Also, $t^2$ does not seem to verify the equation, see for instance x''[t] + x'[t]^2 - x[t] (x[t]^2 - 3/2 x[t] + 1/2) /. x -> (#^2 &) // Factor // FullSimplify
– bmf
Commented Apr 2, 2022 at 19:48

Clear["Global*"]

eqns = {x''[t] + x'[t]^2 - x[t] (x[t]^2 - 3/2 x[t] + 1/2) == 0,
x[0] == 1, x[1] == 2};

sol = NDSolveValue[eqns, x, {t, 0, 1}]


data = sol /@ Range[0.1, 0.9, 0.1]

{1.11777, 1.22389, 1.32168, 1.41398, 1.50345, 1.59261, 1.68403, \
1.78037, 1.88458}

Show[
Plot[sol[t], {t, 0, 1}],
ListPlot[data, DataRange -> {0.1, 0.9}]]


ClearAll[x, t]
ode = x''[t] + x'[t]^2 - x[t]*(x[t]^2 - 3/2*x[t] + 1/2) == 0
bc = {x[0] == 1, x[1] == 2};
sol = NDSolveValue[{ode, bc}, x, {t, 0, 1}];
data = Table[{t,sol[t]}, {t, Range[0.1, 0.9, 0.1]}]
ListLinePlot[data, Mesh -> All, MeshStyle -> Red,
GridLines -> Automatic, GridLinesStyle -> LightGray]
`