the reason is pretty simple. You are asking for an output from the function, but you have not provided any in its definition.
Had you written
function z = polygon( x,y )
axis([-1 1 -1.6 1])
z = (whatever)
then the call would have worked. Or you can leave the function as is and just call it: