summaryrefslogtreecommitdiff
path: root/solution_visualization.m
blob: b886722870c6ca4778d6e7aa0ad68f8864115a05 (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
function solution_visualization(q0,x0, qf, xf, optics, lambda)



x=linspace(x0,xf,1000); % we will calculate beam profile between x0 and xf
fprintf('======== Forward propagation ======\n')
q_forward=gbeam_propagation(x,q0,x0,optics);
[w_forward,r_forward]=q2wr(q_forward, lambda);

fprintf('======== Backward propagation =====\n')

q_backward=gbeam_propagation(x,qf,xf,optics);
[w_backward,r_backward]=q2wr(q_backward, lambda);

fprintf('========= Plotting ================\n')
plot ( ...
	x,w_forward, '-r',  ...
	x,-w_forward, '-r', ...
	x, w_backward, '-.b', ...
	x, -w_backward, '-.b')
legend({'forward propagation', '', 'backward propagation', ''})      

fprintf('======= final check =============\n')
fprintf('following are desired values: \n')

fprintf('======= after propagation ========\n')
fprintf('values below should match wf and rf: \n')
[waste_at_the_end,radius_at_the_end]  = q2wr(q_forward(end), lambda);
waste_at_the_end
radius_at_the_end