Sampling time as an input-simulink

痴心易碎 提交于 2019-12-25 02:59:25

问题


I am trying to make a library of functions that will allow me to parameterize filters and other function. In simulink standard blocks, I am only able to set a sampling time prior, rather than take an input. Is there any ideas on how I can create this? My first approach was to use conditionals and a clock to allow this parameter to exist, but the clock cannot be parameterized either.

Thanks in advance.


回答1:


The only way to do this is to write each of your blocks as S-Functions.

If you are using m-code then within the setup method you'll need to define the block sample time as

block.SampleTimes = [-2 0];

then within the output method you'll need to set the next sample time (based on the value of the input signal) by assigning the new value into block.NextTimeHit. An example of doing this can be found here: A Square Wave with Jitter

A similar thing can be done in a c-mex S-Function by using the mdlGetTimeOfNextVarHit method.



来源:https://stackoverflow.com/questions/30352543/sampling-time-as-an-input-simulink

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!