Terminating some Simulink samples

조회 수: 4 (최근 30일)
Jim Clay
Jim Clay 2012년 11월 27일
I have a serial stream of samples in my Simulink model and I would like to be able to "terminate" the first N samples. Is there a way to do that?

채택된 답변

Babak
Babak 2012년 11월 28일
this is how I would do it:
I would put a clock block (in Simulink sources library) and connect it to a "compare to constant" block (in Simulink logic and bit operations library).
This way you can compare the time with any number you choose and you will get a 0 or 1 out of the compare to constant block. Knowing what is your smpling time, you can conver, comparing the clock (time) with a constant to comparing the sample number with a constant just by dividing time out of clock with sampling time which can be found in the "Weighted Sample Time" block (in simulink Signal attributes library)
  댓글 수: 3
Ilham Hardy
Ilham Hardy 2012년 11월 28일
"Switch" block?
Babak
Babak 2012년 11월 28일
It depends on what blocks your model includes.
For example you can multiply that 0/1 signal with any signal you want like signals coming out of a source block. This way the source result will be zero for specific sampling times.
Or you can use a switch block as Ilham mentioned. This way you can feed the 0/1 signal to the middle inport signal of the switch block and put your other signals on the other inports of that.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Event Functions에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by