'How to simulate a discrete ODE in MATLAB with adaptive step size?

I have a discrete ODE, where u is the input and y is the output and dy is the derivative of y.

dy = @(y, u) 229.888852 - 0.050251*y + 3.116311*u + 0.000075 * y^2

I want to simulate this system with a ODE-solver e.g ODE45. But ODE45 requries a time vector t e.g

tspan = [0 5];
y0 = 0;
[t,y] = ode45(@(t,y) 2*t, tspan, y0);

And I don't have the t in my discrete ODE. I found it difficult to use ODE45 or other ODE-solvers in MATLAB / Octave because they don't handle discrete ODE's.

My question is simple:

How to simulate a discrete ODE in MATLAB with adaptive step size?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source