Output argument 'd' is not assigned on some execution paths.
Show older comments
I am not understand what's wrong about it. Hope someone to help me find the error. Like the title, the error refers to the d in the first line and the following is the code. Many thanks
function d = fcn(i,Vo)
%%initialize all parameter
persistent PPo LPo detaPo PVo LVo detaVo D detaD n;
if isempty(PPo)% present PV array output power (t[n+1])
PPo=0;
end
if isempty(LPo)% last time PV array output power (t[n])
LPo=0;
end
if isempty(detaPo)% the difference of power output between present one and last one
detaPo=0;
end
if isempty(PVo)% present PV array output voltage (t[n+1])
PVo=0;
end
if isempty(LVo)% last time PV array output voltage (t[n])
LVo=0;
end
if isempty(detaVo)% the difference of output voltage between the last one and present one
detaVo=0;
end
if isempty(D)%duty circle
D=0.3;
end
if isempty(detaD)%min step of changing duty circle
detaD=0.1;
end
if isempty(n)% counting number
n=1;
end
%%main coding
while (detaPo~=0)
d=D;
PVo=-Vo;
PPo=PVo*i;
detaVo=PVo-LVo;
detaPo=PPo-LPo;
if detaPo>=0
if PVo>=0
d=d-detaD;
else
d=d+detaD;
end
else
if PVo>=0
d=d+detaD;
else
d=d-detaD;
end
end
PVo=LVo;
PPo=LPo;
end
Accepted Answer
More Answers (0)
Categories
Find more on Sources 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!