Simulink upper bound is not specified

1 次查看(过去 30 天)
Hi,
I am trying to built a Matlab function in Simulink. The function code is provided below, but I keep getting this error: "Output 'Q' has variable size but the upper bound is not specified; explicit upper bound must be provided." I read that it is related with Simulation target and Dynamic memory allocation in Matlab is checked. Also, I checked the variable size in edit data window and set type as double.
I could not figured out what might be problem and how to solve it. Any help will be appreciated, thanks in advance.
function [Q, H] = deneme_roots(C1,C2,C3,C4,C5,C6)
r = roots([C5 (-C1+2*C4-C6) (3*C2-3*C5) (C1-2*C3+C6) -C2]);
r = r(r==conj(r)); % discard complex-conjugate roots
Jr = ((1./(r.^2+1).^2).*(r.^4*C4-2*C5*r.^3+(C1+C6)*r.^2-2*C2*r+C3))';
J = Jr;
Q = r(Jr==J); % keep Q that minimizes cost function
H = (2/(Q^2+1)^4)*(-2*C5*Q^5+(3*C1-6*C4+3*C6)*Q^4+(-12*C2+16*C5)*Q^3 ...
+(-8*C1+10*C3+6*C4-8*C6)*Q^2+(12*C2-6*C5)*Q+(C1-2*C3+C6));

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by