MATLAB: Arcus tangent function error

errorsimulinktangnet

Hi, I have created a function for calculating arc of tangent. I have occured error saying "Output argument 'teta' is not assigned on some execution paths"
function teta = myatan(x, z)
z = -z;
if nargin==1
x_o=1;
end
if x>0
teta=atan(z/x);
elseif z>=0 & x<0
teta=pi+atan(z/x);
elseif z<0 & x<0
teta=-pi+atan(z/x);
elseif z>0 & x==0
teta=pi/2;
elseif z<0 & x==0
teta=-pi/2;
end

Best Answer

You don't cover the case where x==0 and z==0.