QZ factorization for generalized eigenvalues
[AA,BB,Q,Z] = qz(A,B)
[AA,BB,Q,Z,V,W] = qz(A,B)
[AA,BB,Q,Z] = qz(A,B) for square matrices A and B, produces upper quasitriangular matrices AA and BB, and unitary matrices Q and Z such that Q*A*Z = AA, and Q*B*Z = BB. For complex matrices, AA and BB are triangular.
Produces a possibly complex decomposition with a triangular AA. For compatibility with earlier versions, 'complex' is the default.
Produces a real decomposition with a quasitriangular AA, containing 1-by-1 and 2-by-2 blocks on its diagonal.
If AA is triangular, then the diagonal elements a = diag(AA) and b = diag(BB) are the generalized eigenvalues that satisfy
A*V*b = B*V*a b'*W'*A = a'*W'*B
The eigenvalues produced by lambda = eig(A,B) are the ratios of the diagonal elements a and b, such that lambda = a./b.
If AA is not triangular, it is necessary to further reduce the 2-by-2 blocks to obtain the eigenvalues of the full system.