Effacer les filtres
Effacer les filtres

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

25 vues (au cours des 30 derniers jours)
James Murray
James Murray le 1 Avr 2014
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

Réponse acceptée

Mischa Kim
Mischa Kim le 1 Avr 2014
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);

Plus de réponses (1)

Niklas Nylén
Niklas Nylén le 1 Avr 2014
Use the Add block with one single + in the "list of signs". See attached example.

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by