MATLAB function in Simulink
Mostra commenti meno recenti
I need some help to finish my simulink model of an ESP sistem. I need to find the real roots of a 6th order polynomial in Simulink and use it for the simulation. I Made a MATLAB function block and wrote this code:
function x = fcn(A)
%#codegen
K=0.25;
P = [K -(K+1) K+1 -(K+1) K+1 -(K+1) 1-A];
r = roots(P);
real = r(imag(r)==0);
x = real(real<1.1);
A is an variable and K is an constant. x has to be just one number. After Runing the code in i get this errors in simulink:
Data 'x' is inferred as a variable size matrix, while its specified type is something else.
Error in port widths or dimensions. Invalid dimension has been specified for input 'A'.
To be honest im not sure if this will work in any way but this is my try. Ive checked the code in MATALB and it gives me what i want. Im not rly sure what these errors means. How can i make it work to get the roots of an polynomial in Simulink?
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su FPGA, ASIC, and SoC Development in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!