% abs2 of the part of the rotation result which is orthogonal to the desired solution % want to make this zero % % options=optimset("Display","iter","TolX",10*eps,"TolFun",eps*eps) % [X, FVAL] = fminsearch(@f,t0,options) % function r2 = f( t) phi0 = t(1); phi1 = t(2); e0 = exp(i*phi0); e1 = exp(i*phi1); N = 8; x = 0.883883476483184; y = 0.467707173346743; % r = ((e1*(1-e0)*sqrt(N-1))/N)*x + ((-e0*(N-1)-1)/N)*y; r2 = real(r)*real(r) + imag(r)*imag(r); end % % N=8 % s=ones(8,1)/sqrt(N) % w=zeros(8,1); w(2)=1 % sp = (sqrt(N)*s-w)/sqrt(N-1) % H=[-(2-N), 2*sqrt(N-1); -2*sqrt(N-1), (N-2)]/N % q=s % x=1/sqrt(N) % y=sqrt((N-1)/N) % z=H*[x;y] % z = x,y used above after one standard rotation