How to solve MATLAB problem "code generation"

4 views (last 30 days)
Hello... I have a question about matlab. I got a problem during running my simulation. MATLAB give instruction "Code generation failed Inferred complexity ('on') for data 'm_dot_A_output' (#26) does not match specified complexity ('off')"
if function m_dot_A_output = fcn(Av, PA) %#codegen
% Initialize output in case something goes wrong.
m_dot_A_output = 0;
k = 1.4; Cf=0.7; T=294.5; C1=0.0404; C2=0.1562; Pcr=0.528; Pa = 101325;
if Pa/PA <= Pcr
m_dot_A_output = Cf*Av*C1*(PA/sqrt(T));
elseif Pa/PA > Pcr
m_dot_A_output = Cf*Av*C2*(PA/sqrt(T))*(Pa/PA)^(1/k)*sqrt(complex(1-(Pa/PA)^((k-1)/k)));
end
Hope you can solve this problem...i really need your help thank you.

Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!