Adding all the elements of a 1-d matrix/array in Simulink

13 ビュー (過去 30 日間)
James Murray
James Murray 2014 年 4 月 1 日
回答済み: Mischa Kim 2014 年 4 月 1 日
Hi
I have a variable named "power" that contains 25 constant values. I would like to sum them up using a function block in Simulink. I would like that to be done instantly in one timestep. Any suggestions to what can I use?
Thanks

採用された回答

Mischa Kim
Mischa Kim 2014 年 4 月 1 日
James, as you suggest, you could use a MATLAB function block (used to be called Embedded MATLAB function) with the following code inside:
function y = fcn(u)
y = sum(u);

その他の回答 (1 件)

Niklas Nylén
Niklas Nylén 2014 年 4 月 1 日
Use the Add block with one single + in the "list of signs". See attached example.

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by