You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: polyinit.m
    path of file: ./repos/Robotics-Toolbox/rvcdlcs/src/planning/polytope
    
    the code of the file until where you have to start completion: function [nodez, nodepoly, nodezinpoly] = polyinit(nodez,nodepoly,nodezinpoly,config,envir,robotnum,dispbaseref,dispendref)
% polyinit    Initialize a polygraph

    
function [nodez, nodepoly, nodezinpoly] = polyinit(nodez,nodepoly,nodezinpoly,config,envir,robotnum,dispbaseref,dispendref)
% polyinit    Initialize a polygraph

% set nodez to all zero
znum = size(nodez,1);
polynum = length(nodepoly);
% generate nodes outside obstacles
randnode = [envir.start;envir.goal];
randnum = size(randnode,1);
for i=1:randnum
    % generate ploytope
    randpoly = polyinflate(envir.obstacle,randnode(i,:),envir);
    % check whether formation exists in a polytope
    [randz,exit] = poly2nodez(randpoly,randnode(i,:),config,envir,robotnum,dispbaseref,dispend