MATLAB: MY ODE is giving two solutions

ode solving

y = dsolve('Dy = (1+2*t)*sqrt(y)', 'y(0)=1.0')
y =
(t*(t + 1) + 2)^2/4
(t*(t + 1) - 2)^2/4
how to plot 'y' w.r.t 't' with t varying from 0 to 5 with step size 0.25

Best Answer

y = dsolve('Dy = (1+2*t)*sqrt(y)', 'y(0)=1.0')
t=0:0.25:5;
out=subs(y,t)
plot(t,out)