aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mode_match.m20
-rw-r--r--solution_visualization.m14
2 files changed, 11 insertions, 23 deletions
diff --git a/mode_match.m b/mode_match.m
index c08ccd6..443412a 100644
--- a/mode_match.m
+++ b/mode_match.m
@@ -1,6 +1,8 @@
-function [ possible_lens_placement, possible_lens_set, possible_sample_energy, pick_of_n_best_lens_placements, index ] = mode_match( q0, qf, Ltot, lambda, lens_permutations )
-%MODE_MATCH Summary of this function goes here
-% Detailed explanation goes here
+function [ possible_lens_placement, possible_lens_set, possible_sample_energy] = mode_match( q0, qf, Ltot, lambda, lens_permutations )
+%Shuffles lenses into random positions and stores possible solutions
+% Shuffles over entire lens permutation array for n_shuffles times.
+% Afterwards, solutions are sorted by Energy and truncated to n_truncate
+% decimal places. Similar solutions are then removed from the array.
n_perms = size(lens_permutations,1);
n_shuffles=20; %number of random placements of lenses
@@ -35,16 +37,4 @@ parfor i = 1:N
end
-%Sorting possible solution according to energy
-[possible_sample_energy, index] = sort(possible_sample_energy);
-possible_lens_placement = possible_lens_placement(index,:);
-possible_lens_set = possible_lens_set(index,:);
-
-%Truncate other possible solutions to an accuracy of n decimal places
-n=4;
-possible_lens_placement_trunc = round(possible_lens_placement*10^n)./10^n;
-[possible_lens_placement_uniq, index] = unique(possible_lens_placement_trunc,'rows','stable'); %Unique solutions only
-
-pick_of_n_best_lens_placements = min(5,size(possible_lens_placement_uniq,1));
-
end
diff --git a/solution_visualization.m b/solution_visualization.m
index 6eebae6..c099d78 100644
--- a/solution_visualization.m
+++ b/solution_visualization.m
@@ -1,18 +1,18 @@
function waste_at_the_end = solution_visualization(q0,x0, qf, xf, optics, lambda)
-
-
+%Propagates beam with given input parameters
+% Forward propagation and backward propagation are taken in order to
+% visualize reasonable solutions.
x=linspace(x0,xf,1000); % we will calculate beam profile between x0 and xf
-%fprintf('======== Forward propagation ======\n')
+%Forward propagation
q_forward=gbeam_propagation(x,q0,x0,optics);
[w_forward,r_forward]=q2wr(q_forward, lambda);
-%fprintf('======== Backward propagation =====\n')
-
+%Backward propagation
q_backward=gbeam_propagation(x,qf,xf,optics);
[w_backward,r_backward]=q2wr(q_backward, lambda);
-%fprintf('========= Plotting ================\n')
+%Plot beam profile
plot ( ...
x,w_forward, '-r', ...
x,-w_forward, '-r', ...
@@ -21,7 +21,5 @@ plot ( ...
legend({'forward propagation', '', 'backward propagation', ''})
[waste_at_the_end,radius_at_the_end] = q2wr(q_forward(end), lambda);
-%waste_at_the_end
-%radius_at_the_end