Create a repeating sequence without interpolation
11 views (last 30 days)
I have a signal output from a Simulink model that I need to apply a "modulation" to. The modulation parameters are defined in a file, as a Nx2 array of time and factor values, which needs to be repeated for the length of the Simulink signal. I tried using the Repeating Sequence block, which is perfect except it interpolates values which I do not want. Is there a way to turn off interpolation for this block?
For example, I was given this modulation waveform:
% modulation definiton
modSig = [ 0.00 1;
30.0 0 ];
Meaning the signal should be 1 at 0 - 5.5 seconds, 0 at 5.5 - 15 seconds, -1 at 15 to 20.5 seconds, and zero at 20.5 to 30 seconds, and this pattern should repeat for the duration of the input Simulink signal.
Giving this to Repeating Sequence, I get a value of 0.5 at the transitions rather than the desired 1, 0, or -1 value.
I can also do this directly in the code for my application, if there's a simpler method to do it that way.
Available toolboxes: Simulink, Stateflow, Signal Processing, System Identification.
Andy Bartlett on 5 Jul 2023
There are three repeating sequence blocks in Simulink.
With the right choice for Lookup Method, the block
Repeating Sequence Interpolated
can do what you are seeking
To get a staircase shape to the output waveform, set the Lookup Method to
Use Input Below
You'll enter two vectors to describe the waveform.
You only enter the start of each staircase, EXCEPT you also need to indicate where the last staircase ends.
The model used is attached.
More Answers (1)
Fangjun Jiang on 5 Jul 2023
I found it impossible to use the "Repeating Sequence" block due to the "breakpoints must be strictly monotonically increasing" error. Other blocks like Signal Builder or Signal Editor block can implement the perpendicular edge but there is no option to repeat the sequence.
Luckily, for your need, you can use two Pulse Generator blocks adding together. First one is 30 seconds period with 18.33% pulse width. The second one as -1 with 15 seconds phase delay.