Adding all the elements of a 1-d matrix/array in Simulink
14 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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
0 Commenti
Risposta accettata
Mischa Kim
il 1 Apr 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);
0 Commenti
Più risposte (1)
Niklas Nylén
il 1 Apr 2014
Use the Add block with one single + in the "list of signs". See attached example.
0 Commenti
Vedere anche
Categorie
Scopri di più su Simulink Functions in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!