aboutsummaryrefslogtreecommitdiff
path: root/solution_visualization.m
diff options
context:
space:
mode:
authorMatt Argao <mcargao@email.wm.edu>2013-02-20 14:15:44 -0500
committerMatt Argao <mcargao@email.wm.edu>2013-02-20 14:15:44 -0500
commit12948ff5436c6c385d239572f5eb20ed19f93392 (patch)
treeb958bf4ecc977050f18fe8da5bd62084168cd9cb /solution_visualization.m
parentfebb98c32e259ca4f4e574faef4b157c8d1f2830 (diff)
downloadmode_match-12948ff5436c6c385d239572f5eb20ed19f93392.tar.gz
mode_match-12948ff5436c6c385d239572f5eb20ed19f93392.zip
Displays lenses in beam propogation graph.
Diffstat (limited to 'solution_visualization.m')
-rw-r--r--solution_visualization.m38
1 files changed, 36 insertions, 2 deletions
diff --git a/solution_visualization.m b/solution_visualization.m
index 6f8fddb..280860c 100644
--- a/solution_visualization.m
+++ b/solution_visualization.m
@@ -1,11 +1,19 @@
-function [waste_at_the_end, radius_at_the_end] = solution_visualization(q0,x0, qf, xf, optics, lambda)
+function [waste_at_the_end, radius_at_the_end, waist_at_lens_position] = 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.
+%Array of lens positions
+n_lens = size(optics,2);
+
+for i = 1:n_lens
+ lens_position(i) = optics{i}.x;
+end
+
x=linspace(x0,xf,1000); % we will calculate beam profile between x0 and xf
+
%Forward propagation
-q_forward=gbeam_propagation(x,q0,x0,optics);
+[q_forward, q_lens] =gbeam_propagation(x,q0,x0,optics);
[w_forward,r_forward]=q2wr(q_forward, lambda);
%Backward propagation
@@ -20,6 +28,32 @@ subplot(2,1,1); plot ( ...
x, -w_backward, '-.b')
legend({'forward propagation', '', 'backward propagation', ''})
+%Find waist at lens positions
+waist_at_lens_position = zeros(1,n_lens);
+
+for i = 1:n_lens
+ waist_at_lens_position(i) = q2wr(q_lens(i), lambda);
+end
+
+
+%Distance from x-axis
+waist_at_lens_position = waist_at_lens_position;
+
+%Plot lenses
+color = ['r' 'g' 'b'];
+for i = 1:n_lens
+ x1 = optics{i}.x;
+ y1 = waist_at_lens_position(i);
+ x2 = x1;
+ y2 = -waist_at_lens_position(i);
+
+ line([x1;x2], [y1;y2], 'LineWidth', 5, 'Color', color(i));
+end
+
+
+
[waste_at_the_end,radius_at_the_end] = q2wr(q_forward(end), lambda);
+
+