Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
mado
Posts:
102
Registered:
5/24/12
|
|
embedded matlab function error
Posted:
Feb 8, 2013 12:12 PM
|
|
i have this error message "Output argument 'dvref' is not assigned on some execution paths." when executing this code function dvref =IC(V,I)
persistent Vref Vold Iold c; if isempty(Vold) Vold=0; %initialized only once in the beginning end if isempty(Iold) Iold=0; %initialized only once in the beginning end if isempty(c) c = .1; %initialized only once in the beginning end if isempty(Vref) Vref=.5; %initialized only once in the beginning end
dI=I-Iold; dV=V-Vold;
if V==Vold if I~=Iold elseif I>Iold dvref=Vref-c else dvref=Vref+c end elseif dI~=-I/V if dI/dV > -I/V dvref=Vref-c else dvref=Vref+c end end Iold=I Vold=V
|
|
|
|