summaryrefslogtreecommitdiff
path: root/solution_visualization.m
blob: 15d52c2cc706c478d000d9e98492b97400ff797b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
source('abcd.m')


% ######################################### 
%  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')


q0=waste_r2q(w0,r0,lambda);
optics={lns1,lns2,lns3};

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')
w0
r0
wf
rf
q0=waste_r2q(w0,r0,lambda);
qtf=gbeam_propagation(Ltot, q0,0, optics);
printf('values below should match wf and rf: \n')
waste = q2waste(qtf, lambda)
radius = q2radius(qtf,lambda)