I'm doing a project in school and I need to evaluate the roots of a 7th order polynomial during a Simulink simulation. For that, I've decided to use the "roots" function but it seems that Simulink doesn't like this function - when running the simulation this error appears:
"Data
radius_new
is inferred as a variable size matrix, while its properties in the Model Explorer specify its size as inherited or fixed. Please check the 'Variable Size' check box and specify the upper bounds in the size field."
The code I have inside my function block is the following:
p = [A*10.^5 B_3*10.^5 B*10.^5 0 E 0 C*10.^5 0 D*10.^5];
R = roots(p);
radius_new = R(real(R)>=0 & imag(R) == 0);
where A, B...are defined constants changing with time.
I have run this on a normal script and it gives the value I need. For some reason, on Simulink, that does not happen.