Clock jumps forward and back in time

Hi, im having trouble with my animation in my simulink. I am plotting a reversing dolly with a trailer. The plot is in my animation function and as one of the inputs is a clock. But my problem is that the time jumps back in time. I have the clock time as a tilte in the plot: hTitle=title(sprintf('Time = %0.3g',t1(1)));. For example it will go from displayinh 0.665 sec to 0.435. I scoped the clock and it seems to be functioning correctly. It also seems to happen at a certain point in my simulation, especially when the dolly is turning. I was wondering if someone has an idea of what it could be that makes this problem.
Thanks in forehand, Soleil

 Accepted Answer

Steven Lord
Steven Lord on 24 Mar 2021
My guess is that you're encountering the situation described at the end of page 7 of the chapter on ODEs in Cleve's Numerical Computing with MATLAB book.
"If this error is less than the specified tolerance, then the step is successful and is accepted. If not, the step is a failure and is rejected. In either case, the error estimate is used to compute the step size h for the next step."
If you're walking down a sidewalk and realize your next step will put you squarely in the middle of a puddle, you may take a smaller next step so the one after that can put you safely across the puddle. Unless you're a little kid, in which case your next step becomes a jump into the center of the puddle with both feet :)

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!