I need to plot the data generated by the Script after a 20 milli second time. So question is "how to produce the time delay in matlab…????" I mean is there any specific command to do so.
MATLAB: Time delay
timetime delay
Related Solutions
Overruns do not necessarily correspond to a particular rate group. Overruns happen when the combination of all of the functions to be executed at a particular time takes longer than the time until the next step. Your minimum step is 0.0005, so at some point the combination of tasks is taking more than 0.0005 s.
t = [0.0005, 0.004, 0.032, 0.12, 0.512, 3.072];t./min(t)ans = 1 8 64 240 1024 6144
so the clock will fire every 0.0005 s, and each time it will run everything in the first group; every 8 ticks it will also run everything in the second group; every 64 ticks it will run everything in the first group together with everything in the second group together with everything in the third group (the counts for those all factor 64); every 240 ticks it would run the first group together with the second group together with the fourth group (all factor into 240), and so on. At
fold(@lcm, t./min(t))ans = 30720
every 30720 ticks it would need to run all 8 groups and finish that before tick 30721, 0.0005 seconds later.
The question is not whether there is one group that runs too slow: the question is whether there is a combination of groups that cannot finish before the next tick... and since all of the blocks will eventually run in a single tick, at lcm() of their times, the question becomes whether all of the blocks together can finish in a single tick.
Certainly if you have a single group that is much more complex than the others then you should address it first, but everything counts.
You can sometimes postpone the effect of running multiple groups by carefully arranging the timings to be relatively prime. For example if the second group ran at every 9 ticks instead of every 8, then instead of groups 1, 2, and 3 all executing every 64 ticks, it would be postponed to every 576 ticks. But no matter what you do, if the simulation runs long enough, the lcm() of all of the timings will arrive and require that all of the groups run in a single tick.
Best Answer