function out=Q(A,N) [V,mu]=eig(N); mu=diag(mu); denom=sqrt(mu)*ones(1,length(mu)); denom=denom+denom'; out=V*( (V'*A*V)./denom )*V'; end