What is the error in my function? Error: Variable 'T' is not fully defined on some execution paths.
Mostrar comentarios más antiguos
This is the code which I wrote for generating a Trapezoid curve for BLDC motor. It is showing the following error: 'Variable 'T' is not fully defined on some execution paths'. The code:
% code
function y = fcn(u)
%#codegen
Q = mod(u,2*pi);
if Q >=0 && Q<2*pi/3
T = 1;
elseif Q>= 2*pi/3 && Q< pi
T = 1-6*(Q-2*pi/3)/pi;
elseif Q>= pi && Q<5*pi/3
T = -1;
elseif Q>= 5*pi/3 && Q<2*pi
T = -1 + 6*(Q-5*pi/3)/pi;
end
y=T;
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Motor Control Blockset en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!