diff options
author | Matt Argao <mcargao@email.wm.edu> | 2012-10-18 17:42:16 -0400 |
---|---|---|
committer | Matt Argao <mcargao@email.wm.edu> | 2012-10-18 17:42:16 -0400 |
commit | 80b72a51a3f8f0e33bf79a20a4d5fbaca050d920 (patch) | |
tree | 50b45f2d8d10ee378f32e00530c5b2349fd8232e /fitter_check.m | |
parent | e7699104e7439eacf3135515df320ee15aea0929 (diff) | |
download | mode_match-80b72a51a3f8f0e33bf79a20a4d5fbaca050d920.tar.gz mode_match-80b72a51a3f8f0e33bf79a20a4d5fbaca050d920.zip |
Added possible permutations of lens choices
Diffstat (limited to 'fitter_check.m')
-rw-r--r-- | fitter_check.m | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/fitter_check.m b/fitter_check.m index 1898120..53d3299 100644 --- a/fitter_check.m +++ b/fitter_check.m @@ -6,11 +6,15 @@ Ltot= 1.010675025828971 ; r0= 1.0E+100 ; w0= 2.563E-5 ; x0= 0 ; -lns1.abcd=abcd_lens( 0.075 ) ; +focal_length1 = .075; +focal_length2 = .075; +focal_length3 = .203; + +lns1.abcd=abcd_lens( focal_length1 ) ; lns1.x= 0.21358727296049 ; -lns2.abcd=abcd_lens( 0.075 ) ; +lns2.abcd=abcd_lens( focal_length2 ) ; lns2.x= 0.40361319425309 ; -lns3.abcd=abcd_lens( 0.203 ) ; +lns3.abcd=abcd_lens( focal_length3 ) ; lns3.x= 0.80361319425309 ; wf= 3.709E-5 ; rf= 1.0E+100 ; @@ -32,24 +36,38 @@ sample_energy = []; sample_x = []; lens_size = .03; -for iteration = 1:10 - optics_x_rand = sort(lens_size+(xf-2*lens_size)*rand(1,3)); - - fitness_simplified=@(x) fitness(q0, qf, Ltot, x ); - [x_sol, energy]=fminsearch(fitness_simplified, optics_x_rand, optimset('TolX',1e-8,'TolFun',1e-8,'MaxFunEvals',1e8,'MaxIter',2000)); +%Lens permutations +lens_permutations = perms( [ focal_length1, focal_length2, focal_length3 ]); +n_perms = size(lens_permutations,1); +n_shuffles=10; + +for i = 1:n_perms + + + lenses_choice=lens_permutations(i,:) - sample_energy = [sample_energy; energy]; - sample_x = [sample_x; x_sol]; + for iteration = 1:n_shuffles + optics_x_rand = sort(lens_size+(xf-2*lens_size)*rand(1,3)); + + fitness_simplified=@(x) fitness(q0, qf, Ltot, x, lenses_choice ); + [x_sol, energy]=fminsearch(fitness_simplified, optics_x_rand, optimset('TolX',1e-8,'TolFun',1e-8,'MaxFunEvals',1e8,'MaxIter',2000)); + + sample_energy = [sample_energy; energy]; + sample_x = [sample_x; x_sol]; + + figure(2) + solution_visualization(q0,x0, qf, xf, optics_placer(x_sol, lenses_choice), lambda); + drawnow; + end - figure(2) - solution_visualization(q0,x0, qf, xf, optics_placer(x_sol), lambda); end [energy_min, index_of_energy_min] = min(sample_energy(:)) x_sol = sample_x(index_of_energy_min,:); +lenses_choice=lens_permutations(ceil(index_of_energy_min/n_shuffles),:); figure(2) -w_final_trial = solution_visualization(q0,x0, qf, xf, optics_placer(x_sol), lambda); +w_final_trial = solution_visualization(q0,x0, qf, xf, optics_placer(x_sol, lenses_choice), lambda); title('Optimized made'); w_final_handmade; |