How to Subtract Consecutive Values in Array in Simulink

Hi Everyone, I am wondering what is the correct way to do subtraction of consecutive values of an array in Simulink? For example, if an output of a block is [1,2,3,4,...] and I need to calculate [1,2-1,3-2,4-3,...]. Knowing, both vectors are needed to execute the Simulink scheme. what is the best way to do that? please help
Thanks in advance,

 採用された回答

Aquatris
Aquatris 2018 年 7 月 22 日

0 投票

You can use a time delay block and use fixed step solver. Set the time delay to be exactly the time step used by the solver. You connect the signal to the time delay block. Then to get the vector you want, you subtract output of time delay block from the original signal.

3 件のコメント

Omar
Omar 2018 年 7 月 23 日
Thank you Aquatris for your help. Are you referring to the Unit Delay block? would the Memory block be also another option for this case? thanks again,
Aquatris
Aquatris 2018 年 7 月 23 日
I was thinking of transport delay block but you can also use unit delay block as well. I do not know much about the memory block.
Omar
Omar 2018 年 7 月 23 日
thank you so much

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSimulink についてさらに検索

質問済み:

2018 年 7 月 22 日

コメント済み:

2018 年 7 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by