MATLAB: Solving non linear differential equations

differential equationsmathematicsMATLAB

I am working at a mathematical problem and I wanted to solve it numerically through MATLAB. The equation has the form:
epsilon*y'(t) =t*y(t)(y(t)-a)(y(t)-b)+c
where a<0 and b>0 and c>0

Best Answer

a = -0.2;
b = 0.1;
c = 0.1;
epsilon = 1.0;
fun = @(t,y)(t*y*(y-a)*(y-b)+c)/epsilon;
tspan = [0 3.5];
y0 = 0;
[T,Y] = ode45(fun,tspan,y0);
plot(T,Y)