What is the error in my function? Error: Variable 'T' is not fully defined on some execution paths.
Afficher commentaires plus anciens
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;
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Motor Control Blockset dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!