function sys_augmented = output_state_augmentation2(sys, n)
    arguments
        sys ss
        n (1,1) double {mustBeInteger,mustBeNonnegative}
    end

    yidx = startsWith(sys.OutputName, output_name);
    ny = sum(yidx);
    nz = size(sys, 1) - ny;

    A = [sys.A zeros(n, ny); double(vpa(sys.C(yidx,:)) * vpa(sys.A)) zeros(ny, ny)];
    B = [sys.B; double(vpa(sys.C(yidx,:)) * vpa(sys.B))];
    C = [sys.C zeros(ny+nz,ny)];
    C(yidx, :) = [zeros(ny, n) eye(ny)];
    D = sys.D;

    sys_augmented = ss(A, B, C, D, InputName=sys.InputName, OutputName=sys.OutputName, TimeUnit=sys.TimeUnit);
    sys_augmented.UserData = sys.UserData;
end
