// This GUI file is generated by guibuilder version 2.2
//////////
function Modelo_MMSinfH_Y(handles, arch) //agregar para el menu
archivo=arch;
f=figure('figure_position',[230,20],'figure_size',[900,700],'auto_resize','on','background',[33],'figure_name','Graphic window number %d');
//////////
delmenu(f.figure_id,gettext('File'))
delmenu(f.figure_id,gettext('?'))
delmenu(f.figure_id,gettext('Tools'))
toolbar(f.figure_id,'off')
handles.dummy = 0;
handles.texttitulo=uicontrol(f,'unit','normalized','BackgroundColor',[0.1,0.4,0.3],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[24],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.23,0.89,0.58,0.077619],'Relief','flat','SliderStep',[0.01,0.1],'String','Modelo M/M/S/inf/H con Y Respuestos','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','texttitulo','Callback','')

handles.marco_1=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.03,0.55,0.3,0.288],'Relief','ridge','SliderStep',[0.01,0.1],'String','','Style','frame','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','marco_1','Callback','')

handles.marco_2=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.03,0.175,0.375,0.325],'Relief','ridge','SliderStep',[0.01,0.1],'String','','Style','frame','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','marco_2','Callback','')


//Botones-------------------------------------------------------------------------
handles.btnCalcular=uicontrol(f,'unit','normalized','BackgroundColor',[0.6,0.6,0.6],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.02,0.05,0.15,0.06],'Relief','raised','SliderStep',[0.01,0.1],'String','Calcular','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','btnCalcular','Callback','btnCalcular_MMSN(handles)')
handles.btnLimpiar=uicontrol(f,'unit','normalized','BackgroundColor',[0.6,0.6,0.6],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.25,0.05,0.15,0.06],'Relief','raised','SliderStep',[0.01,0.1],'String','Limpiar','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','btnLimpiar','Callback','btnLimpiar_callback(handles)')
handles.btnSalir=uicontrol(f,'unit','normalized','BackgroundColor',[0.6,0.6,0.6],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.7507042,0.057381,0.1492958,0.0674603],'Relief','raised','SliderStep',[0.01,0.1],'String','Men√∫','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','btnSalir','Callback','btnSalir_callback(handles)')
handles.btnAyuda=uicontrol(f,'unit','normalized','BackgroundColor',[0.4,0.9,0.3],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[24],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.9,0.9,0.05,0.06],'Relief','raised','SliderStep',[0.01,0.1],'String','?','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','btnAyuda','Callback','btnAyuda_MMSinfH_Y(handles)')
//--------------------------------------------------------------------------------

handles.textParam=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[14],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.0585915,0.8035714,0.11,0.065],'Relief','flat','SliderStep',[0.01,0.1],'String','-Parametros-','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textParam','Callback','')
handles.textResultados=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[14],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.05,0.485,0.11,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','-Resultados-','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textResultados','Callback','')
//--------------------------------------------------------------------------------
// parametros
handles.tetxLambda=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.77,0.08,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','Lambda :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','tetxLambda','Callback','')
handles.editLambda=uicontrol(f,'unit','normalized','BackgroundColor',[1,1,1],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.12,0.77,0.07,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editLambda','Callback','')

handles.textMiu=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.72,0.05,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','Miu :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textMiu','Callback','')
handles.editMiu =uicontrol(f,'unit','normalized','BackgroundColor',[1,1,1],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.12,0.72,0.07,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editMiu','Callback','')

handles.textServidores=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.67,0.05,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','S :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textServidores','Callback','')
handles.editServ=uicontrol(f,'unit','normalized','BackgroundColor',[1,1,1],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.12,0.67,0.07,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String',' ','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editServ','Callback','')

handles.textClientes=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.62,0.05,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','H :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textClientes','Callback','')
handles.editClientes=uicontrol(f,'unit','normalized','BackgroundColor',[1,1,1],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.12,0.62,0.07,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editClientes','Callback','')

handles.textValorY=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.57,0.05,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','Y :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textValorY','Callback','')
handles.editValorY=uicontrol(f,'unit','normalized','BackgroundColor',[1,1,1],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.12,0.57,0.07,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editValorY','Callback','')

// tiempo 1
handles.text1=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.21,0.72,0.03,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','t1:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','text1','Callback','')
handles.edit1=uicontrol(f,'unit','normalized','BackgroundColor',[1,1,1],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.24,0.72,0.07,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','edit1','Callback','')
// tiempo 2
handles.text2=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.21,0.66,0.03,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','t2:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','text2','Callback','')
handles.edit2=uicontrol(f,'unit','normalized','BackgroundColor',[1,1,1],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.24,0.66,0.07,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','edit2','Callback','')

//resultados-----------------------------------------------------------------------

//columna 1
handles.textRho=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.4,0.04,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','Rho:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','textRho','Callback','')
handles.editRho=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.09,0.4,0.10,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editRho','Callback','')

handles.tL=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.35,0.04,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','L:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','tL','Callback','')
handles.eL=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.09,0.35,0.10,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','eL','Callback','')

handles.tW=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.04,0.3,0.04,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','W:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','tW','Callback','')
handles.eW=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.09,0.3,0.10,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','eW','Callback','')
handles.txtRhoBarra=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.05,0.25,0.07,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','Rho Barra :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','txtRhoBarra','Callback','')
handles.editRhoBarra=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.14,0.25,0.10,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editRhoBarra','Callback','')
//columna 2
handles.tLambdaMedia=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.205,0.4,0.08,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','E(Lambda) :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','tLambdaMedia','Callback','')
handles.eLambdaMedia=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.29,0.4,0.10,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','eLambdaMedia','Callback','')

handles.tLq=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.205,0.35,0.12,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','Lq :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','tLq','Callback','')
handles.eLq=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.29,0.35,0.10,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','eLq','Callback','')

handles.tWq=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','on','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.205,0.30,0.12,0.04],'Relief','flat','SliderStep',[0.01,0.1],'String','Wq:','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','tWq','Callback','')
handles.eWq=uicontrol(f,'unit','normalized','BackgroundColor',[0.8,0.8,0.8],'Enable','off','FontAngle','normal','FontName','helvetica','FontSize',[12],'FontUnits','points','FontWeight','normal','ForegroundColor',[0,0,0],'HorizontalAlignment','center','ListboxTop',[],'Max',[1],'Min',[0],'Position',[0.29,0.30,0.10,0.04],'Relief','sunken','SliderStep',[0.01,0.1],'String','','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','eWq','Callback','')
handles.grafica= newaxes();handles.grafica.margins = [ 0 0 0 0];handles.grafica.axes_bounds = [0.47,0.2214984,0.4740741,0.4923127];handles.grafica.auto_clear="on";
handles=resume(handles);
endfunction

//////////
// Callbacks are defined as below. Please do not delete the comments as it will be used in coming version
//////////

function btnAyuda_MMSinfH_Y(handles)
//Write your callback for  btnAyuda  here
archivo=archivo+"Manuales/Manual_de_Usuario_Modelo_MMSinfH_Y.pdf"
    if isfile(archivo) then
        winopen(archivo);
    else
        messagebox("No se Encontro el Archivo",'ADVERTENCIA','info')
    end

endfunction

funcprot(0);
function btnCalcular_MMSN(handles)

    miu = evstr(get(handles.editMiu,'String'));
    lambda = evstr(get(handles.editLambda,'String'));
    h = evstr(get(handles.editClientes,'string'));
    s = evstr(get(handles.editServ,'String'));
    y = evstr(get(handles.editValorY,'String'));
    
    //Modelo M/M/s/inf/H con Y Repuesto   
    c=ones(1,y+h+1);
    ro=lambda/(miu*s);
    set(handles.editRho,'String',string(ro));
    
    if (s<=y)   //Si s<=y
       for i=2:s+1
         c(i)=c(i-1)*lambda*h/(miu*(i-1));
       end
       for i=s+2:y+1
         c(i)=h*ro*c(i-1);
       end
       for i=y+2:y+h+1
         c(i)=c(i-1)*ro*(h+y-(i-1)+1);
       end
   else				//s>y
       for i=2:y+1
         c(i)=c(i-1)*lambda*h/(miu*(i-1));
       end
       for i=y+2:s+1
         c(i)=(h+y-(i-1)+1)*lambda/((i-1)*miu)*c(i-1);
       end
       for i=s+2:y+h+1
         c(i)=(h+y-(i-1)+1)*ro*c(i-1);
       end
   end
   
   vector_p=ones(1,y+h+1);
   
   vector_p(1)=1/sum(c);
   
   for i=2:y+h+1
      vector_p(i)=c(i)*vector_p(1);
   end
   
   //n es un vector formado por 1,2,...y+h
   n=linspace(1,y+h,y+h);
   
   L=sum(n.*vector_p(2:y+h+1));
   set(handles.eL,'String',string(L));
            
   lambdabarra=0;
   for i=y:y+h
        lambdabarra=(i-y)*vector_p(i+1)+lambdabarra;
   end
   
   lambdabarra=lambda*(h-lambdabarra);
   set(handles.eLambdaMedia,'String',string(lambdabarra));
   
   w_n=L/lambdabarra;
   set(handles.eW,'String',string(w_n));
   
   wq_n=w_n-1/miu;
   set(handles.eWq,'String',string(wq_n));
   
   lq_n=lambdabarra*wq_n;
   set(handles.eLq,'String',string(lq_n));
   
   ro_barra=lambdabarra/(s*miu);
   set(handles.editRhoBarra,'String',string(ro_barra));
   
   Grafica_MMSinfH_Y(lambda,miu,h,s);

endfunction
function Grafica_MMSinfH_Y(lambda,miu,h,s,y)
        x=linspace(0,2, 100);
        aux=0;
        for i=y:y+h
            aux=(i-y)*vector_p(i+1)+aux;
        end
        aux=h-aux;
   
        for i=1:y
            vector_q(i)=h*vector_p(i)/aux;
        end
        for i=y+1:y+h
            vector_q(i)=(h+y-(i-1))*vector_p(i)/aux;
        end
        
        variable_a_wqt=ones(1,length(x));
        variable_s_wqt=ones(1,length(x));
        variable_b_wqt=vector_q(s+1)*ones(1,length(x));
        
        for variable_n_wqt=s+1:h-1
            variable_a_wqt=variable_a_wqt.*(miu*x*s/(variable_n_wqt-s));
            variable_s_wqt=variable_s_wqt+variable_a_wqt;
            variable_b_wqt=variable_b_wqt+vector_q(variable_n_wqt+1)*variable_s_wqt;
        end
   
        //Calcula Wq(t)
        wq_t=1-variable_b_wqt.*exp(-miu*x*s);
        
        w_t=1-exp(-(miu-lambda)*x);
        for i=1:length(w_t)
          if (w_t(i)<0)
            w_t(i)=0;
          end
        end
    
        for i=1:length(wq_t)
          if (wq_t(i)<0)
            wq_t(i)=0;
          end
        end
   
   plot(x,w_t,'r-',x,wq_t,'b');
   xgrid;
  
endfunction



function btnLimpiar_callback(handles)
   
   set(handles.editServ, 'String',' ');
   set(handles.editLambda, 'String',"");
   set(handles.editMiu, 'String',"");
   set(handles.editClientes, 'String',"");
   set(handles.editValorY, 'String',"");
   set(handles.edit1, 'String',"");
   set(handles.edit2, 'String',"");
   
   set(handles.eL, 'String',"");
   set(handles.eLq, 'String',"");
   set(handles.eW, 'String',"");
   set(handles.eWq, 'String',"");
   set(handles.eLambdaMedia, 'String',"");
   set(handles.editRhoBarra, 'String',"");
   set(handles.editRho, 'String',"");
   
   if ~isempty(handles.grafica.children) then
                 delete(handles.grafica.children);
   end

endfunction


function btnSalir_callback(handles)
//Write your callback for  btnSalir  here
    close();

endfunction
