Why does NextTimeHit always return 0 in Matlab S-Functions?
1 次查看(过去 30 天)
显示 更早的评论
I need to compute the step size (i.e. dt) in the discrete update method of a Matlab S-Function whose Sample Time is set to be "Inherited" (i.e. [-1 0]). However, regardless of the Sample Time specification (e.g. Inherited, Continuous, Discrete, Variable), the "block.NextTimeHit" always return "0" even though it is decleared as R/W in its Matlab Documentation.
- Why does NextTimeHit always return 0 in Matlab S-Functions?
- How can I infer the actual step size in update method of (Discrete) Matlab S-Functions for inherited and variable sample times?
0 个评论
采纳的回答
Archit Dhanani
2019-7-25
the NextTimeHit is the API used specifically for variable discrete rates. You can read more about it in the page:
To get the actual step size used in the update method, you will have to use Dwork vectors. The link below demonstrates an example for using Dwork vectors:
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Block and Blockset Authoring 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!