summaryrefslogtreecommitdiff
path: root/solution_visualization.m
blob: 68b7a5599648fcf99fe70e4c89bf100640bc1225 (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
source('answ.txt');


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);

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);

printf('========= Plotting ================\n')
plot (x,w_forward, '1;forward propagation;', x, w_backward, '2;backward propagation;', ...
      x,-w_forward, '1;;', x, -w_backward, '2;;')

printf('======= final check =============\n')
printf('following are desired values: \n')
w0
r0
x0
wf
rf
xf
printf('======= after propagation ========\n')
printf('values below should match wf and rf: \n')
waste_at_the_end  = q2waste(q_forward(end), lambda)
radius_at_the_end = q2radius(q_forward(end),lambda)