How do I call an anonymous function inside the MATLAB function block in Simulink 8.1 (R2013a)?
More Answers (1)
If sum(q) == 0 because all of the entries are 0, then you only store into Q(1) and none of the other locations in Q.
Remember that the first assignment to a variable determines the size of the variable, so the first thing you should do is
Q = zeros(1,n);