If you want to create a function that behaves like isosurface()
you can take a look at how it's done in it. You can do so by entering edit isosurface
in the Matlab console.
The part regarding the light when there is no axes is this one:
if isempty(ax)
view(3);
camlight; lighting gouraud
end