aboutsummaryrefslogtreecommitdiff
path: root/fitness.m
diff options
context:
space:
mode:
authorMatt Argao <mcargao@email.wm.edu>2012-11-13 16:48:48 -0500
committerMatt Argao <mcargao@email.wm.edu>2012-11-13 16:48:48 -0500
commit9306970c62771c6c9393ce14f00ff9490ad3239c (patch)
treef5e1e793cf1de5a3949abe1a95871491fd78ae29 /fitness.m
parenta0f747be9349e7954a0116b362772403d88219b3 (diff)
downloadmode_match-9306970c62771c6c9393ce14f00ff9490ad3239c.tar.gz
mode_match-9306970c62771c6c9393ce14f00ff9490ad3239c.zip
Optimized test point selection in fitness
Diffstat (limited to 'fitness.m')
-rw-r--r--fitness.m24
1 files changed, 14 insertions, 10 deletions
diff --git a/fitness.m b/fitness.m
index 752e748..55f9d76 100644
--- a/fitness.m
+++ b/fitness.m
@@ -1,9 +1,17 @@
function [Energy, Waist, Penalty] = fitness( q_0, q_final, x_final, optics_positions, optics_focal_length, lambda )
-%FITNESS Summary of this function goes here
-% Detailed explanation goes here
+%Outputs fitness of suggested solution
x0 = 0;
- Np=20;
- x=linspace(x0,x_final,Np);
+ Np=20; % # of pts between start position and second lens
+ N_collimated = 10; % # of pts between second lens and third lens to be collimated region
+
+ x1=optics_positions(1);
+ x2=optics_positions(2);
+ x3=optics_positions(3);
+
+ x_array1=linspace(x0,x2,Np);
+ x_array2=linspace(x2, x3, N_collimated);
+ x = cat(2,x_array1,x_array2);
+
q_f_trial_forward = gbeam_propagation(x,q_0,x0,optics_placer(optics_positions, optics_focal_length));
[Waist_trial_forward, Radius_trial_forward] = q2wr(q_f_trial_forward, lambda);
q_f_trial_backward = gbeam_propagation(x,q_final,x_final,optics_placer(optics_positions, optics_focal_length));
@@ -18,9 +26,7 @@ function [Energy, Waist, Penalty] = fitness( q_0, q_final, x_final, optics_posit
% do not put lenses too close to each other and end positions
lens_size=0.03;
- x1=optics_positions(1);
- x2=optics_positions(2);
- x3=optics_positions(3);
+
d(1)=abs(x1-x2);
d(2)=abs(x2-x3);
@@ -53,9 +59,7 @@ function [Energy, Waist, Penalty] = fitness( q_0, q_final, x_final, optics_posit
% make collimated region between 2nd and 3rd lens
%intialize intermediate points between lenses
- intermediate_positions = linspace(optics_positions(2), optics_positions(3),10);
- f_q_x = @(x) gbeam_propagation(x,q_0,x0,optics_placer(optics_positions, optics_focal_length));
- q_intermediate = arrayfun(f_q_x,intermediate_positions);
+ q_intermediate = q_f_trial_forward((x2<x) & (x<x3));
lambda_over_waist_sq = (-imag(1./q_intermediate)); %with numerical factor
coef = 1e-3;