summaryrefslogtreecommitdiff
path: root/fitter_check.m
blob: 51e1480f615c462c2e38b44d44832ab4b0de3d1d (plain)
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
lens_set = [.075, .203, .05, .03];
lens_set = [.075,.203];
lens_permutations = pick(lens_set,3,'or');

% ########################################## 
% Sample Solution
lambda= 1.064E-6 ;
Ltot= 1.010675025828971 ;
r0= 1.0E+100 ;
w0= 2.563E-5 ;
x0= 0 ;
wf= 3.709E-5 ;
rf= 1.0E+100 ;
xf= Ltot;

q0=wr2q(w0,r0,lambda);
x0=0;
qf=wr2q(wf,rf,lambda);
xf=Ltot;
% 
% optics={lns1,lns2,lns3};
% figure(1)
% w_final_handmade = solution_visualization(q0,x0, qf, xf, optics, lambda);
% title('Hand made');
% ########################################## 

[ possible_lens_placement, possible_lens_set, possible_sample_energy, n_possible_lens_placement, index  ] = mode_match( q0, qf, Ltot, lambda, lens_permutations );

%Visualize five best solutions
for n_graph = 1:n_possible_lens_placement
    figure(n_graph)
    w_final_trial = solution_visualization(q0,x0, qf, xf, optics_placer(possible_lens_placement(index(n_graph),:), possible_lens_set(index(n_graph),:)), lambda);
    
    str1=sprintf('\n f_1 = %0.4f, x_1 = %0.4f\n',possible_lens_set(index(n_graph),1),possible_lens_placement(index(n_graph),1));
    str2=sprintf('f_2 = %0.4f, x_2 = %0.4f\n',possible_lens_set(index(n_graph),2),possible_lens_placement(index(n_graph),2));
    str3=sprintf('f_3 = %0.4f, x_3 = %0.4f\n',possible_lens_set(index(n_graph),3),possible_lens_placement(index(n_graph),3));
    tstr='Other Solutions';
    title([tstr, str1, str2, str3]);
end

possible_lens_placement(index(1:n_graph),:)
possible_lens_set(index(1:n_graph),:)
possible_sample_energy(index(1:n_graph),:)


%Visualize fitness function for fixed f2 and f3
lens_set = [.075, .075, .203];
f2= 0.40361319425309 ;
f3= 0.80361319425309 ;

fitness_simplified=@(x) fitness(q0, qf, Ltot, [x, f2, f3], lens_set, lambda );
figure(6)
ezplot(fitness_simplified, [0,Ltot])