Hello, I wrote this code in MATLAB Function and I get this error " Output argument 'y' is not assigned on some execution paths. Function 'Commutation and inverter/Commutation/MATLAB Function' (#41.11.31), line 1, column 12: "commutation_inverter". I don'y know what I'm missing. I hope you can help me.
Thank you !
function y=commutation_inverter(pos,Vs,ea,eb,ec,Ia,Ib,Ic)if (pos>=0)&&(pos<60)&&(Ic<=0)&&(Ib<=0) y = [Vs,0.5*(-Vs+ea+eb-2*ec)];elseif (pos>=0)&&(pos<60)&&(Ic>0)&&(Ib<=0) y = [Vs,0];elseif (pos>=0)&&(pos<60)&&(Ic>=0)&&(Ib>0) y = [Vs,0.5*(-Vs+ea+eb-2*ec)];elseif (pos>=0)&&(pos<60)&&(Ic<0)&&(Ib>0) y = [Vs,-Vs];elseif(pos>=60)&&(pos<120)&&(Ib>=0)&&(Ia>=0) y=[0.5*(Vs+ea-2*eb+ec),0.5*(Vs-ea+2*eb-ec)];elseif(pos>=60)&&(pos<120)&&(Ib<0)&&(Ia>=0) y=[0,Vs];elseif(pos>=60)&&(pos<120)&&(Ib<=0)&&(Ia<0) y=[0.5*(Vs+ea-2*eb+ec),0.5*(Vs-ea+2*eb-ec)];elseif(pos>=60)&&(pos<120)&&(Ib>0)&&(Ia<0) y=[Vs,0];elseif(pos>=120)&&(pos<180)&&(Ia<=0)&&(Ic<=0) y=[0.5*(-Vs+2*ea-eb-ec),Vs];elseif(pos>=120)&&(pos<180)&&(Ia>0)&&(Ic<=0) y=[-Vs,Vs];elseif(pos>=120)&&(pos<180)&&(Ia>=0)&&(Ic>0) y=[0.5*(-Vs+2*ea-eb-ec),Vs];elseif(pos>=120)&&(pos<180)&&(Ia<0)&&(Ic>0) y=[0,Vs];elseif(pos>=180)&&(pos<240)&&(Ic>=0)&&(Ib>=0) y = [-Vs,0.5*(Vs+ea+eb-2*ec)];elseif(pos>=180)&&(pos<240)&&(Ic<0)&&(Ib>=0) y = [-Vs,0];elseif(pos>=180)&&(pos<240)&&(Ic<=0)&&(Ib<0)y = [-Vs,0.5*(Vs+ea+eb-2*ec)];elseif(pos>=180)&&(pos<240)&&(Ic>0)&&(Ib<0) y = [-Vs,Vs];elseif(pos>=240)&&(pos<300)&&(Ib<=0)&&(Ia<=0) y=[0.5*(-Vs+ea-2*eb+ec),0.5*(-Vs-ea+2*eb-ec)];elseif(pos>=240)&&(pos<300)&&(Ib>0)&&(Ia<=0) y=[0,-Vs];elseif(pos>=240)&&(pos<300)&&(Ib>=0)&&(Ia>0) y=[0.5*(-Vs+ea-2*eb+ec),0.5*(-Vs-ea+2*eb-ec)];elseif(pos>=240)&&(pos<300)&&(Ib<0)&&(Ia>0) y=[-Vs,0];elseif(pos>=300)&&(pos<360)&&(Ia>=0)&&(Ic>=0) y=[0.5*(Vs+2*ea-eb-ec),-Vs];elseif(pos>=300)&&(pos<360)&&(Ia<0)&&(Ic>=0) y=[Vs,-Vs];elseif(pos>=300)&&(pos<360)&&(Ia<=0)&&(Ic<0) y=[0.5*(Vs+2*ea-eb-ec),-Vs];elseif(pos>=300)&&(pos<360)&&(Ia>0)&&(Ic<0) y=[0,-Vs];end
Best Answer