Create a repeating sequence without interpolation

15 ビュー (過去 30 日間)
Daniel Flisek
Daniel Flisek 2023 年 7 月 3 日
コメント済み: Daniel Flisek 2023 年 7 月 6 日
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.

採用された回答

Andy Bartlett
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
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.
Daniel Flisek
Daniel Flisek 2023 年 7 月 6 日
Thank you for such a detailed answer and sample model! This is perfect.

サインインしてコメントする。

その他の回答 (1 件)

Fangjun Jiang
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.

カテゴリ

Help Center および File ExchangeSignal Attributes and Indexing についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by