Repeating a loop/iteration in a for loop (for adaptive time stepping)

2 views (last 30 days)
Hi,
I am trying to write a code for adaptive time stepping using the explicit euler method.
I was wondering if there is a way to repeat an iteration for a 'for' loop which has an if-else statement like this:
if error is greater than tolerance
Throw current results away, and decrease time step using a specific formula and redo calculations for the current iteration
Else
Accept results and calculate new increased time step, and continue with calculations for next iteration
end
Thank you for the help!
Regards
Ushnik

Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!