if (model.v>0) model.n_t = floor(2 * model.r / model.v / model.dt); if (model.n_t > options.max_t) if (model.n_t < options.max_t / 2) t = model.dt:model.dt:options.max_t * model.dt; model.delta_theta = pi / 180 / 2; %approx. else middle = model.dt * model.n_t / 2; beg = middle - options.max_t * model.dt; t = beg + model.dt:model.dt:middle; model.delta_theta = atan((model.r - model.v * beg)) / 180; end model.n_t = options.max_t; else t = 0:model.dt:2 * model.r / model.v - model.dt; end else t = 0:40 / model.n_t:40; end