// This GUI file is generated by guibuilder version 2.2
/////////
function Modelo_MM1K(handles, arch) //agregar para el menu
archivo=arch;
f=figure('figure_position',[361,45],'figure_size',[801,767],'auto_resize','on','background',[12],'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.txtTema=uicontrol(f,'unit','normalized','BackgroundColor',[0.7,0.1,0.1],'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.0511073,0.9026174,0.7921635,0.0671141],'Relief','flat','SliderStep',[0.01,0.1],'String','METODO  M/M/1/K','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','txtTema','Callback','')
handles.btAyuda=uicontrol(f,'unit','normalized','BackgroundColor',[0.4,0.9,0.3],'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.8688245,0.9026174,0.0459966,0.0604027],'Relief','raised','SliderStep',[0.01,0.1],'String','?','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','btAyuda','Callback','btAyuda_MM1K(handles)')
handles.marco1=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.0815503,0.6092841,0.2350937,0.2551678],'Relief','ridge','SliderStep',[0.01,0.1],'String','UnName3','Style','frame','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','marco1','Callback','')
handles.txtLamda=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.1022147,0.8107606,0.0613288,0.033557],'Relief','flat','SliderStep',[0.01,0.1],'String','Lamda :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','txtLamda','Callback','')
handles.editLamda=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.1737649,0.8040492,0.1124361,0.0402685],'Relief','sunken','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editLamda','Callback','')
handles.txtMiu=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.1022147,0.7503579,0.0357751,0.033557],'Relief','flat','SliderStep',[0.01,0.1],'String','Miu :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','txtMiu','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.1737649,0.7481208,0.1124361,0.0402685],'Relief','sunken','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editMiu','Callback','')
handles.txtValorK=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.1022147,0.6966667,0.0306644,0.0268456],'Relief','flat','SliderStep',[0.01,0.1],'String','K :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','txtValorK','Callback','')
handles.editValorK=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.1737649,0.6921924,0.1124361,0.0402685],'Relief','sunken','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editValorK','Callback','')

handles.txtValorT=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.11,0.64,0.021,0.026087],'Relief','flat','SliderStep',[0.01,0.1],'String','t1 :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','txtValorT','Callback','')
handles.editValorT=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.14,0.635,0.0412655,0.0391304],'Relief','sunken','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editValorT','Callback','')

handles.txtValorW_t=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.20,0.64,0.021,0.026087],'Relief','flat','SliderStep',[0.01,0.1],'String','t2 :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','txtValorW_t','Callback','')
handles.editValorT2=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.23,0.635,0.0412655,0.0391304],'Relief','sunken','SliderStep',[0.01,0.1],'String','0','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editValorT2','Callback','')

handles.btCalcular=uicontrol(f,'unit','normalized','BackgroundColor',[0.7,0.1,0.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.1382112,0.5455928,0.1171039,0.0402685],'Relief','raised','SliderStep',[0.01,0.1],'String','CALCULAR','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','btCalcular','Callback','btCalcular_MM1K(handles)')
handles.marco2=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.0611073,0.0769799,0.2810903,0.4496644],'Relief','ridge','SliderStep',[0.01,0.1],'String','UnName13','Style','frame','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','marco2','Callback','')
handles.txtValorL=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.076661,0.3555705,0.0153322,0.0268456],'Relief','flat','SliderStep',[0.01,0.1],'String','L :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','txtValorL','Callback','')
handles.editVlaorL=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.13,0.3462416,0.1022147,0.0402685],'Relief','sunken','SliderStep',[0.01,0.1],'String',' ','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editVlaorL','Callback','')
handles.txtValorW=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.076661,0.4125503,0.0255537,0.0268456],'Relief','flat','SliderStep',[0.01,0.1],'String','W :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','txtValorW','Callback','')
handles.editValorW=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.13,0.4062416,0.1022147,0.0402685],'Relief','sunken','SliderStep',[0.01,0.1],'String',' ','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editValorW','Callback','')
handles.txtValorWq=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.076661,0.30,0.0306644,0.0268456],'Relief','flat','SliderStep',[0.01,0.1],'String','Wq :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','txtValorWq','Callback','')
handles.editValorWq=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.13,0.29,0.1022147,0.0402685],'Relief','sunken','SliderStep',[0.01,0.1],'String',' ','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editValorWq','Callback','')
handles.txtValorLq=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.076661,0.24,0.0204429,0.033557],'Relief','flat','SliderStep',[0.01,0.1],'String','Lq :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','txtValorLq','Callback','')
handles.editValorLq=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.13,0.23,0.1022147,0.0402685],'Relief','sunken','SliderStep',[0.01,0.1],'String',' ','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editValorLq','Callback','')
handles.txtLamdaMedia=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.076661,0.4751902,0.1071039,0.0268456],'Relief','flat','SliderStep',[0.01,0.1],'String','Lamda Media :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','txtLamdaMedia','Callback','')
handles.editValorLamdaMedia=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.2042078,0.4662416,0.1022147,0.0402685],'Relief','sunken','SliderStep',[0.01,0.1],'String',' ','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editValorLamdaMedia','Callback','')
handles.grafica= newaxes();handles.grafica.margins = [ 0 0 0 0];handles.grafica.axes_bounds = [0.3933589,0.1391792,0.51875,0.4559687];handles.grafica.auto_clear="on";
handles.btnLimpiar_MM1K=uicontrol(f,'unit','normalized','BackgroundColor',[0.7,0.1,0.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.1233163,0.0245646,0.1303061,0.0405405],'Relief','raised','SliderStep',[0.01,0.1],'String','LIMPIAR','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','btnLimpiar_MM1K','Callback','btnLimpiar_MM1K(handles)')
//Vlores de t
handles.txtValorWq_t=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.076661,0.175,0.0359429,0.0308456],'Relief','flat','SliderStep',[0.01,0.1],'String','W(t) :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','txtValorWq_t','Callback','')
handles.editValorWq_t=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.13,0.11,0.1022147,0.0402685],'Relief','sunken','SliderStep',[0.01,0.1],'String',' ','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editValorWq_t','Callback','')
handles.txtValorW_t=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.076661,0.12,0.05,0.0268456],'Relief','flat','SliderStep',[0.01,0.1],'String','Wq(t) :','Style','text','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','txtValorW_t','Callback','')
handles.editValorW_t=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.13,0.17,0.1022147,0.0402685],'Relief','sunken','SliderStep',[0.01,0.1],'String',' ','Style','edit','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','editValorW_t','Callback','')
handles.btnSalir=uicontrol(f,'unit','normalized','BackgroundColor',[0.4,0.9,0.3],'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','Salir','Style','pushbutton','Value',[0],'VerticalAlignment','middle','Visible','on','Tag','btnSalir','Callback','btnSalir_MM1K(handles)')

handles=resume(handles);
endfunction

//////////
// Callbacks are defined as below. Please do not delete the comments as it will be used in coming version
//////////
funcprot(0)
function btAyuda_MM1K(handles)
    archivo=archivo+"Manuales/Manual_de_Usuario_Modelo_MM1K.pdf"
    if isfile(archivo) then
        winopen(archivo);
    else
        messagebox("No se Encontro el Archivo",'ADVERTENCIA','info')
    end
endfunction


function btCalcular_MM1K(handles)
        ieee(2);
        aux=0;
        lambda=evstr(get(handles.editLamda, 'string'));
        if lambda<=0 then
            messagebox([" El valor de Lambda no puede ser menor o igual a cero ","para realizar los calculos, Digte Lambda y de un Enter"],"ERROR","error");
            aux=1;
        end
        miu=evstr(get(handles.editMiu, 'string'));
        if miu<=0 then
            messagebox([" El valor de Miu no puede ser menor o igual a cero ","para realizar los calculos, Digte miu y de un Enter"],"ERROR","error"); 
            aux=1;
        end
        k=evstr(get(handles.editValorK, 'string'));
        if k<=0 then
            messagebox([" El valor de k no puede ser menor o igual a cero ","para realizar los calculos, Digte k y de un Enter"],"ERROR","error"); 
            aux=1;
        end
        auxT=0;
        t1=evstr(get(handles.editValorT, 'string'));
        if t1<0 then
            messagebox([" El valor del Tiempo 1 no puede ser menor a cero ","para realizar los calculos, Digte Tiempo 1 y de un Enter"],"ERROR","error");
            aux=1;
        elseif t1==0
            auxT=auxT+1;     
        end
        auxresT=t1;
        t2=evstr(get(handles.editValorT2, 'string'));
        if t2<0 then
            messagebox([" El valor del Tiempo 2 no puede ser menor a cero ","para realizar los calculos, Digte Tiempo 2 y de un Enter"],"ERROR","error");
            aux=1;
        elseif t2==0
            if auxT==1 then
                t2=0;
            else
                if t1>=t2 then
                    messagebox([" El valor del Tiempo 1 no puede ser mayor al Tiempo 2 ","para realizar los calculos, Vuelva Tiempos y de un Enter"],"ERROR","error");
                    aux=1;     
                end  
            end
        else
        auxresT2=t2;
            if auxresT>=auxresT2 then
                messagebox([" El valor del Tiempo 1 no puede ser igual al Tiempo 2 ","para realizar los calculos, Vuelva Tiempos y de un Enter"],"ERROR","error");
                aux=1;
            end
        end
        if aux==1 then
            Limpiar2_MM1K();
        else
        if lambda/miu==1 then
            L=(k+1)/2;
            set(handles.editVlaorL, 'String',string(L));
        
            lambdaBarra=lambda*(k+1)/(k+2);
            set(handles.editValorLamdaMedia, 'String',string(lambdaBarra));
        else
            ro=lambda/miu;
            L=(ro/(1-ro))-(k+2)*((ro).^(k+2))/(1-((ro).^(k+2)));
            set(handles.editVlaorL, 'String',string(L));
            lambdaBarra=lambda*(((ro).^(k+1))-1)/(((ro).^(k+2))-1);  
            set(handles.editValorLamdaMedia, 'String',string(lambdaBarra));
        end 
        
        W=L/lambdaBarra;
        set(handles.editValorW, 'String',string(W));
        
        Wq=W-1/miu;
        set(handles.editValorWq, 'String',string(Wq));
        
        Lq=lambdaBarra*Wq;
        set(handles.editValorLq, 'String',string(Lq));
              
        Grafica_MM1K(lambda,miu,k,t1,t2);
        end
endfunction

function Grafica_MM1K(lambda,miu,k,t1,t2)
       
       if t2==0 then
            t2_aux=0;
            t2=k;
       else
            t2_aux=t2;
       end
        
      x=linspace(t1,t2, 100);
      vector_p=ones(1,k+2);
      
      if (lambda/miu == 1)
        vector_p=vector_p*(1/(k+2));
      else
         ro=(lambda/miu);
         n=linspace(0,k+1,k+2); //n es un vector 0,1,...k
         //vector_p=(ro-1)/(power(ro,k+2)-1)*power(ro,n);
         vector_p=(ro-1)/(((ro).^(k+2))-1)*(ro.^n);
         clear ro;
         clear n;
      end
               
      n2=linspace(0,k,k+1);
      vector_q=vector_p(n2+1)/(1-vector_p(k+2));

      variable_a_wqt=ones(1,length(x));
      variable_s_wqt=ones(1,length(x));
      if (k==0)
            variable_b_wqt=0;
      else
            variable_b_wqt=vector_q(2)*ones(1,length(x));
      end
      
      for variable_n_wqt=2:k
            variable_a_wqt=variable_a_wqt.*(miu*x/variable_n_wqt);
            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);
     
      if t1==0 then
          if t2_aux==0 then
              set(handles.editValorWq_t, 'String',' ');
          else
              set(handles.editValorWq_t, 'String',string(wq_t(100)));
          end
      else
          set(handles.editValorWq_t, 'String',string(wq_t(100)));
      end
     
     
      
      variable_a_wt=ones(1,length(x));
      variable_s_wt=ones(1,length(x));
      variable_b_wt=vector_q(1)*ones(1,length(x));
  
      for variable_n_wt=1:k
            variable_a_wt=variable_a_wt.*(miu*x/variable_n_wt);
            variable_s_wt=variable_s_wt+variable_a_wt;
            variable_b_wt=variable_b_wt+vector_q(variable_n_wt+1)*variable_s_wt;
      end
      
   
      //Calcula W(t)
      w_t=1-variable_b_wt.*exp(-miu*x);
      if t1==0 then
        if t2_aux==0 then
          set(handles.editValorW_t, 'String',' ');
        else
            set(handles.editValorW_t, 'String',string(w_t(1)));  
        end
      else
        set(handles.editValorW_t, 'String',string(w_t(1)));
      end
      
     
      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;xlabel('x'), ylabel('y');
endfunction

function btnLimpiar_MM1K(handles)
    set(handles.editLamda, 'string', ' ');
    set(handles.editMiu, 'string', ' ');
    set(handles.editValorK, 'string', ' ');
    set(handles.editValorT, 'String','0');
    set(handles.editValorT2, 'String','0');  
    
    
    
    set(handles.editVlaorL, 'String',' ');
    set(handles.editValorLq, 'String',' ');
    set(handles.editValorLamdaMedia, 'String', ' ');
    set(handles.editValorW, 'String',' ');
    set(handles.editValorWq, 'String',' ');
    set(handles.editValorWq_t, 'String',' '); 
    set(handles.editValorW_t, 'String',' ');   
    if ~isempty(handles.grafica.children) then
                 delete(handles.grafica.children);
       end
    
endfunction

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

endfunction

function Limpiar2_MM1K()       
       set(handles.editVlaorL, 'String',' ');
       set(handles.editValorLq, 'String', ' ');
       set(handles.editValorLamdaMedia, 'String', ' ');
       set(handles.editValorW, 'String', ' ');
       set(handles.editValorWq, 'String', ' ');
       set(handles.editValorWq_t, 'String', ' ');
       set(handles.editValorW_t, 'String', ' ');
       if ~isempty(handles.grafica.children) then
                 delete(handles.grafica.children);
       end     
endfunction
