Create a repeating sequence without interpolation
조회 수: 15 (최근 30일)
이전 댓글 표시
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;
5.50 1;
5.50 0;
15.0 0;
15.0 -1;
20.5 -1;
20.5 0;
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.
댓글 수: 0
채택된 답변
Andy Bartlett
2023년 7월 5일
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.
댓글 수: 2
Fangjun Jiang
2023년 7월 6일
Good to know the other two blocks. They've been there since R2006a?! I wonder why the three are not combined.
추가 답변 (1개)
Fangjun Jiang
2023년 7월 5일
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.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!