1 function [OUT]=rot(
S); %03.04.2001, Bjorn G.
2 %CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
3 %C Rotating e-vectors so that the imag. parts are minimized in the "least squares sense"
4 %C V. Brandwajn, EMTP Newsletter, August 1982 :
12 % Calculate min/max-value for square sum (error) of imag.parts :
27 % Deciding which solution (1,2) will produce the smallest error :
34 % Square
sum (error) of solution :
39 aaa = aaa + (imag(SA(
j,col)))^2; %
Q2A(
j,
i)**2
45 % Square
sum (error) of solution
#2 :
50 aaa = aaa + (imag(
SB(
j,col)))^2; %
Q2A(
j,
i)**2
56 % Picking the solution (1,2) with the smallest square
sum :
57 if(err1(col)<err2(col))
63 % Rotating e-vector
#col :
Square sum(error) of solution aaa=0.0
end Square sum(error) of solution bbb
Picking the solution(1, 2) with the smallest square sum else scale(col)
Deciding which solution(1, 2) will produce the smallest error SB(j, col)
ang(col)=0.5 *atan2(numerator(col)