필터 지우기
필터 지우기

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

조회 수: 25 (최근 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 CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by