

clear;

theta=10;

alpha=0.3;

delta=1;

beta=0.6;

xkmin=0.01;

xkmax=4;

maxit=39;

N=4;

M=zeros(maxit,N);



        for i=1:N,

         ZK(i)=i;

         %xkmin+(i-1)*(xkmax-xkmin)/(N-1);

         VOLD(i)=0;

        end



for it=1:maxit,        

  for i=1:N,

   VV=-0.00001;

    for j=1:N,

      VZ=log(theta*ZK(i)^alpha-ZK(j)+(1-delta)*ZK(i))+beta*VOLD(j);

      if VZ >= VV,

             G(i)=ZK(j);

             VV=VZ;

      else

      end

    end

             V(i)=VV;

             M(it,i)=M(it,i)+V(i);

  end

             M(i,j)

             pause

             

             diff=0;

      for i=1:N,

         DD=abs(VOLD(i)-V(i));

         if DD > diff,

           diff=DD;

         else

         end

         VOLD(i)=V(i);

      end

    if diff <= 0.00000001,

    save bucle3

    'El programa esta terminado, Ctrl-Pausa'

    

    pause

     

    else

    end





end

