What is the error in my function? Error: Variable 'T' is not fully defined on some execution paths.
이전 댓글 표시
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;
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Motor Control Blockset에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!