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!