    
    function [obj,C,Ey]=minloglikMIMO(iper,A,y,P1,P2,P3,P4,P5,R,LP,BL,cn,o2,mv,mb,Res,LP2)
    
    nout=size(y,2);
    N=size(iper,2);
    for i=1:nout;
        if mv==1;
            l=iper(1);
        else
            l=iper([1+P1*(i-1)]:P1*i);
        end
        if mb==1;
            b=iper(1+P1*nout);
        else
            b=iper([1+P1*(i-1+nout)]:P1*(i+nout));
        end
        iper_i=[l b iper([N-Res+1]:N)];
        [obj(i),C(:,:,:,i),Ey(:,:,i)]=minloglik(iper_i,A,y(:,i),P1,P2,P3,P4,P5,R,LP,BL,cn,o2,LP2);
        
    end
    
    obj=sum(obj);