function [A,res,flag] = prediction(this,A,X,t,o)
    
    J = this.systemj;
    ny = sum(this.nametype == 1);
    nt = length(t);
    t1 = t(1);
    
    a0 = nan(ny,nt);
    
    for k = 1 : nt
        try %#ok<TRYNC>
            a0(:,k) = A(1:ny,t1-1);
        end
        nanindex = isnan(a0(:,k));
        a0(nanindex,k) = rand(sum(nanindex),1);
    end
    
    A(ny+1:end,t1) = J*A(:,t1-1);
    
    [a1,~,res,flag] = lsqnonlin(@doobjfunc,a0(:),[],[],o);
    %[a1,res,flag] = fsolve(@do_objfunc,a0(:),o);
    a1 = reshape(a1,ny,nt);
    A(1:ny,t) = a1;
    
    function obj = doobjfunc(p)
        p = reshape(p,ny,nt);
        A(1:ny,t) = p;
        obj = [];
        for tt = t
            if tt > t1
                A(ny+1:end,tt) = J*A(:,tt-1);
            end
            obj = [obj;this.eqtnall(A,X,tt)]; %#ok<AGROW>
        end
    end
    
end