summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--solution_visualization.m63
1 files changed, 21 insertions, 42 deletions
diff --git a/solution_visualization.m b/solution_visualization.m
index 15d52c2..68b7a55 100644
--- a/solution_visualization.m
+++ b/solution_visualization.m
@@ -1,56 +1,35 @@
+source('answ.txt');
-source('abcd.m')
+q0=waste_r2q(w0,r0,lambda);
+x=linspace(x0,xf,1000); % we will calculate beam profile between x0 and xf
+printf('======== Forward propagation ======\n')
+q_forward=gbeam_propagation(x,q0,x0,optics);
+w_forward=q2waste(q_forward, lambda);
+r_forward=q2radius(q_forward,lambda);
-% #########################################
-% an example of 'answ.txt' file
-% lambda= 1.064E-6 ;
-% Ltot= 1 ;
-% r0= 1.0E+100 ;
-% w0= 25.63e-6;
-% lns1.abcd=abcd_lens( 0.25 ) ;
-% lns1.x= 0.37680270021479 ;
-% lns2.abcd=abcd_lens( 0.1 ) ;
-% lns2.x= 0.90277021575519 ;
-% rf=1e100;
-% wf=25.630e-6;
-% #########################################
-source('answ.txt')
+printf('======== Backward propagation =====\n')
+q_backward0=waste_r2q(wf,rf,lambda);
+q_backward=gbeam_propagation(x,q_backward0,xf,optics);
+w_backward=q2waste(q_backward, lambda);
+r_backward=q2radius(q_backward,lambda);
-q0=waste_r2q(w0,r0,lambda);
-optics={lns1,lns2,lns3};
+printf('========= Plotting ================\n')
+plot (x,w_forward, '1;forward propagation;', x, w_backward, '2;backward propagation;', ...
+ x,-w_forward, '1;;', x, -w_backward, '2;;')
-x=0:.001:Ltot;
-printf('======== Forward propagation ======\n')
-q1=gbeam_propagation(x,q0,0,optics);
-w1=q2waste(q1, lambda);
-r1=q2radius(q1,lambda);
-
-printf('======== Backward propagation ===\n')
-%because of back propagation
-rf=-rf;
-q1b=waste_r2q(wf,rf,lambda);
-
-q2b=gbeam_propagation(x,q1b,Ltot,optics);
-printf('=================================\n')
-wb=q2waste(q2b, lambda);
-rb=q2radius(q2b,lambda);
-plot (x,w1, '1;forward propagation;', x, wb, '2;backward propagation;', ...
- x,-w1, '1;;', x, -wb, '2;;')
-
-printf('=================================\n')
printf('======= final check =============\n')
-printf('======= after propagation ========\n')
-printf('following are theoretical values: \n')
+printf('following are desired values: \n')
w0
r0
+x0
wf
rf
-q0=waste_r2q(w0,r0,lambda);
-qtf=gbeam_propagation(Ltot, q0,0, optics);
+xf
+printf('======= after propagation ========\n')
printf('values below should match wf and rf: \n')
-waste = q2waste(qtf, lambda)
-radius = q2radius(qtf,lambda)
+waste_at_the_end = q2waste(q_forward(end), lambda)
+radius_at_the_end = q2radius(q_forward(end),lambda)