I am writing a Runga Kutta 4 algorithm in MATLAB. I would like to add adaptive step sizing to this algorithm.
From what I've read it seems you calculate the value of the function for two step sizes on each iteration and then from the size of the error terms you deduce which one to use as $y_{i+1}$. But I can't see any advantage in efficiency if you are calculating two potential $y_{i+1}$'s on each iteration.
Obviously I am missing/misinterpreted something as I have read that adaptive step sizing can lead to huge performance increases. So how does adaptive step sizing work for RK methods and can someone tell me the steps I need to implement?