summaryrefslogtreecommitdiff
path: root/solution_visualization.m
blob: 2cf8ce77e0a7e0d9d3a38616daa1b00c79c74c58 (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
function [waste_at_the_end, radius_at_the_end] = 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.

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

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

%Plot beam profile
plot ( ...
	x,w_forward, '-r',  ...
	x,-w_forward, '-r', ...
	x, w_backward, '-.b', ...
	x, -w_backward, '-.b')
legend({'forward propagation', '', 'backward propagation', ''})      

[waste_at_the_end,radius_at_the_end]  = q2wr(q_forward(end), lambda);