How to run a periodic custom signal in simulink

I created a custom signal to run in a simulink model using an embedded MATLAB Function. Now I would like to repeat this signal periodically for a certain amount of time. How can I implement the periodic repetition in Simulink? I thought to use a while-loop but it does not work.
Thank you for any idea!

Answers (2)

You can use a repeated sequences block

3 Comments

Hi, Thank you for the answer. I already tried to use the repeating sequence and it could be a good solution. The only problem I have is that the period of my signal is changing depending on other parameters and, sice the repeating sequence block does nbot accept inputs, I don't know how to modify that value.
Maybe you can help me solve this problem.
Post your model and your embedded function
Hi, I worked more on the idea of a "repeated sequence -like" signal and I think solved the problem. I did something similar to a repeated sequence, which made my function periodical. As input time I created a block with the function rem(u[1],u[2]), with u[1]=clock and u[2]=period. In this way I can change the input "period" as I wish during the run. Thank you anyway for your suggestion, it helped me to think more in that direction.

Sign in to comment.

You'll need to write your MATLAB Function so that it repeats the same operation periodically. How do you maintain the "state" of the block? Do you use a persistent variable, or use the Clock block?

2 Comments

Hi, Thank you for your answer. In the while I used the clock block, but it does not seem to be a good choice.
Vera: I didn't mean for you to use the Clock block inside the While iterator. I was only asking how to maintain the state of the block.

Sign in to comment.

Products

Asked:

on 28 Feb 2013

Community Treasure Hunt

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

Start Hunting!