-
Notifications
You must be signed in to change notification settings - Fork 3
/
spasalt_inten_calc.m
77 lines (59 loc) · 1.83 KB
/
spasalt_inten_calc.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
%%%%%%%%%%%%%%%%%%%%%%%%%%
%% lambdaG_gen.m
%% Alex Cerjan
%% 5/21/14
%%
%% Calculates the generalized overlap coefficient lambdaG
%% given knowledge of the overlap elements chi_mu,nu
%%%%%%%%%%%%%%%%%%%%%%%%%%
function [] = spasalt_inten_calc(datadir, nModes, which_results)
switch which_results
case 1
load([datadir,'spasalt_uniform_results.mat'],'AmatUni','D_uni', ...
'D_uni_interacting');
D = D_uni;
Dint = D_uni_interacting;
Amat = AmatUni;
case 2
load([datadir,'spasalt_adaptive.mat'],'AmatAdap','D_adaptive_nonInt', ...
'D_adaptive_interacting');
D = D_adaptive_nonInt;
Dint = D_adaptive_interacting;
Amat = AmatAdap;
case 3
load([datadir,'spasalt_condensed.mat'],'AmatCond','D_conden', ...
'D_conden_interacting');
D = D_conden;
Dint = D_conden_interacting;
Amat = AmatCond;
otherwise
error('I do not know which set of results to calculate the intensity for.');
end
int_vec = zeros(nModes);
for ii=2:nModes
for jj=1:(ii-1)
b = b_gen(jj,(ii-1),Amat);
c = c_gen(jj,(ii-1),Amat,D);
int_vec(ii,jj) = c*Dint(ii) - b;
%int_vec(ii,jj) = abs(c*Dint(ii) - b);
end
end
figure(1);
cc = distinguishable_colors(nModes);
for ii=1:nModes
plot(Dint(1:nModes),int_vec(:,ii),'Color',cc(ii,:));
hold on;
end
hold off;
end
%%%%%%%
function [c_mu] = c_gen(mu, n, Amat, d0vec)
Amat = Amat(1:n,1:n);
aInvMat = inv(Amat);
c_mu = sum(aInvMat(mu,:).' ./ d0vec(1:n));
end
function [b_mu] = b_gen(mu, n, Amat)
Amat = Amat(1:n,1:n);
aInvMat = inv(Amat);
b_mu = sum(aInvMat(mu,:));
end