JUK1
interch.m
Go to the documentation of this file.
1 function [OUTS,OUToldS,OUTD]=interch(S,oldS,D,Ncond,fstep); %03.04.2001, Bjorn G.
2 %CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
3 %C Interchanging e-vectors and corresponding e-values so that they become smooth
4 %C functions of frequency. Considers the old eigenvectors one-by-one and finds out by which of
5 %C the new ones the largest dot product is attained.
6 
7 % Translation: stoerst=largest, hjelp=help, opptatt=taken
8 
9 if fstep>1
10  for ii=1:Ncond
11  istoerst=0;
13  for j=1:Ncond
14  dotprod=0;
15  for k=1:Ncond
16  dotprod=dotprod+conj(oldS(k,ii))*S(k,j);
17  end
18  if abs(real(dotprod))>rstoerst
19  rstoerst=abs(real(dotprod));
21  end
22  end
24  ind(ii)=ii;
25  opptatt(ii)=0;
26  end %
27 
28 %C Sorting inner products abs(realdel) in descending order :
29  for ii=1:Ncond
30  for j=1:Ncond-1
31  if(dot(j)<dot(j+1));
32  hjelp(1)=dot(j+1);
33  ihjelp =ind(j+1);
34  dot(j+1)=dot(j);
35  ind(j+1)=ind(j);
36  dot(j)=hjelp(1);
38  end
39  end
40  end
41 
42 %C Doing the interchange in a prioritized sequence :
43  for l=1:Ncond %
44  ii=ind(l);
45  istoerst=0;
46  rstoerst=0;
47 
48  for j=1:Ncond
49  if opptatt(j)==0
50  dotprod=0;
51  for k=1:Ncond
52  dotprod=dotprod+conj(oldS(k,ii))*S(k,j);
53  end
54  if abs(real(dotprod))>rstoerst
55  rstoerst=abs(real(dotprod));
56  istoerst=j;
57  end
58  end
59  end
60 
61  opptatt(ii)=1;
62 
63  hjelp=S(:,ii);
64  S(:,ii)=S(:,istoerst);
66 
67  hjelp=D(ii,ii);
70  end
71 
72 %C Finding out whether the direction of e-vectors are 180deg. in error. Is done by comparing
73 %C sign of dotproducts of e-vectors, for new and old S-matrix :
74  for ii=1:Ncond
75  dotprod=0;
76  for k=1:Ncond
77  dotprod=dotprod+conj(oldS(k,ii))*S(k,ii);
78  end
79  if sign(real(dotprod))<0
80  S(:,ii)=-S(:,ii);
81  end
82  end
83 
84 end %
85 
87 
88 
Turn this into a matrix
Find a complex rational model for freq domain data for a
end if sign(real(dotprod))< 0 S(end end end oldS
Definition: interch.m:86
ihjelp
Definition: interch.m:33
for k
Definition: interch.m:15
D(ii, ii)
hjelp
Definition: interch.m:63
OUTD
Definition: interch.m:89
opptatt(ii)=0
OUToldS
Definition: interch.m:89
istoerst
Definition: interch.m:20
S(:, ii)
OUTS
Definition: interch.m:89
for j
Definition: interch.m:13
rstoerst
Definition: interch.m:12
end if abs(real(dotprod))>rstoerst rstoerst
end end end C Doing the interchange in a prioritized sequence
Definition: interch.m:44
ind(ii)
end end dot(ii)