% QR algorithm with shift

function A = shift_qr(A,N)

[m,m1] = size(A);

for k=1:N
    
    mu = A(m,m);
    [QM,RM] = mgs(A-mu*eye(m));
    A = RM*QM + mu*eye(m);
    
end