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
|
function [ output_args ] = self_gbeam_propagation( w0, x_lens, f, x0, lambda )
%SELF_GBEAM_PROPAGATION Summary of this function goes here
% Detailed explanation goes here
n_lens = 3;
w = w0;
w_pos = x0;
for i = 1:n_lens
x_from_next_lens = x_lens(i) - w_pos(i);
[w_new, s_new] = gaussian_focus(w(i), x_from_next_lens, f(i), lambda);
w(i+1) = w_new;
w_pos(i+1) = x_lens(i) + s_new;
end
x_pos= x_lens;
x(1)=w_pos(1);
waist_prop(1)=w(1);
x_temp=linspace(x0 ,x_pos(1));
waist_prop=[waist_prop w(1)*sqrt(1+((x_temp-w_pos(1))/(pi*w(1)^2/lambda)).^2)];
x=[x x_temp];
for i=1:n_lens
if i == 3
break
end
x_temp=linspace(x_pos(i),x_pos(i+1));
waist_prop=[waist_prop w(i)*sqrt(1+((x_temp-w_pos(i))/(pi*w(i)^2/lambda)).^2)];
x=[x x_temp];
end
x_temp=linspace(x_pos(end),x_pos(end)+abs(f(end)));
waist_prop=[waist_prop w(end)*sqrt(1+((x_temp-w_pos(end))/(pi*w(end)^2/lambda)).^2)];
x=[x x_temp];
figure(1)
plot(x,waist_prop,'r',x,-waist_prop,'r');
end
|