-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspectrum_order2.m
155 lines (134 loc) · 3.7 KB
/
spectrum_order2.m
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
clc;
clear all;
close all
N = 5000;
n0 = 3.3;
L = 1;
k = 4 * pi / L;
lam0 = 1.550;
P = 1;
S0 = 1.000;
Space = P * L / N;
x = -P * L / 2:Space:P * L / 2;
% Kis_eff = n1*n1*ones(1,N + 1);
% ne = sqrt(n1*n1 - lam0*lam0/S0/S0/4);
ne = sqrt(6.148);
Kis_eff = 4.746 * x .* x + 6.767;
Xlimit = 190; Ylimt = 1000;
% wx = ne*tanh(x*k/2);
% Ksi = (wx).^2 - 1i*ne/2*(sech(x*k/2)).^2;
figure
% plot(x,Kis_eff,'r*')
% hold on
plot(x, Kis_eff, 'b--', 'LineWidth', 3)
set(gca, 'FontSize', 14)
set(gcf, 'Position', [00, 00, 400, 300])
Dth = 2 * 1.85 / k / P / L;
parfor X = 1:1:Xlimit
v22 = zeros(1, Ylimt);
v12 = zeros(1, Ylimt);
v21 = zeros(1, Ylimt);
rPer = 0.2 / L;
for Y = 1:1:Ylimt
Ms = eye(2);
Km = (0.01 * X + 0.001i * (Y - Ylimt / 2)) * k;
% Kis_imag = (rPer*rPer*Dth/((k - (Km))^2 + rPer*rPer));
Kis_imag = Dth;
Ksi = Kis_eff - 1i * Kis_imag;
n = sqrt(Ksi);
rPer = 0.2 / L;
D0 = [1 1; ne * Km - ne * Km];
Dn = [1 1; ne * Km - ne * Km];
for kt = 1:1:N + 1
Dv = [1 1; n(kt) * Km - n(kt) * Km];
Pv = [exp(1i * n(kt) * Km * Space) 0; 0 exp(-1i * n(kt) * Km * Space)];
Mv = Dv * Pv * Dv^(-1);
Ms = Ms * Mv;
end
Ms = D0^(-1) * Ms * Dn;
v22(1, Y) = abs(Ms(2, 2));
v12(1, Y) = abs(Ms(1, 2));
v21(1, Y) = abs(Ms(2, 1));
end
Z_22(X, :) = v22;
Z_12(X, :) = v12;
Z_21(X, :) = v21;
X
end
figure
A = flip(log(abs(1 ./ Z_22')));
imagesc(0.01 * (1:1:Xlimit), 0.001 * ((Ylimt:-1:1) - Ylimt / 2), A, [-4 7])
set(gca, 'YDir', 'normal')
set(gcf, 'Position', [00, 00, 400, 300])
set(gca, 'FontSize', 14)
colorbar
%% Data Processing
Dth = 2 * ne / k / P / L;
Km = (1 - 1i * 0.0) * k;
Ksi = Kis_eff - 1i * Dth; %%*(sech(x)-0.5)
n = sqrt((Ksi));
% Km = (0.57 - 1i*0.013)*k;
% Km = (1.38 + 1i*0.12)*k;
Ms = eye(2);
D0 = [1 1; ne * Km - ne * Km];
Dn = [1 1; ne * Km - ne * Km];
Dv = [1 1; n(N + 1) * Km - n(N + 1) * Km];
out(:, 1) = [0; 1];
out(:, 2) = Dv^(-1) * Dn * out(:, 1);
for kt = N - 1:-1:2
Dv = [1 1; n(kt) - n(kt)];
Dv_ = [1 1; n(kt - 1) - n(kt - 1)];
Pv = [exp(1i * n(kt) * Space * Km) 0; 0 exp(-1i * n(kt) * Space * Km)];
Mv_ = Dv_^(-1) * Dv * Pv;
out(:, N - kt + 2) = Mv_ * out(:, N - kt + 1);
end
figure
in = 1;
for kt = 1:in:N
Psi((kt + in - 1) / in) = out(1, kt) * exp(-1i * n(kt) * Km * Space / 2) + ...
out(2, kt) * exp(1i * n(kt) * Km * x(kt) * Space / 2);
end
plot(abs(Psi), 'b*')
set(gca, 'FontSize', 14)
set(gcf, 'Position', [00, 00, 400, 300])
set(gca, 'xtick', [0, N / 4, N / 2, N / 4 * 3, N]);
set(gca, 'xticklabel', {'-0.5', '-0.25', '0', '0.25', '0.5'});
axis([-0 N 0 1.2])
figure
plot(abs(out(1, :)), 'b*')
hold on
plot(abs(out(2, :)), 'r*')
set(gca, 'FontSize', 14)
set(gcf, 'Position', [00, 00, 400, 300])
set(gca, 'xtick', [0, 125, 250, 375, 500]);
set(gca, 'xticklabel', {'-0.5', '-0.25', '0', '0.25', '0.5'});
axis([-0 N 0 1.1])
figure
plot(real(Ksi), 'b*')
hold on
plot(imag(Ksi), 'r*')
set(gca, 'FontSize', 14)
set(gcf, 'Position', [00, 00, 400, 300])
set(gca, 'xtick', [0, N / 4, N / 2, N / 4 * 3, N]);
set(gca, 'xticklabel', {'-0.5', '-0.25', '0', '0.25', '0.5'});
axis([0 N -2 12])
figure
plot(real(n), 'b*')
hold on
plot(imag(n), 'r*')
set(gca, 'FontSize', 14)
set(gcf, 'Position', [00, 00, 400, 300])
set(gca, 'xtick', [0, N / 4, N / 2, N / 4 * 3, N])
set(gca, 'xticklabel', {'-0.5', '-0.25', '0', '0.25', '0.5'});
axis([0 N -1 3.5])
yt = sign(x);
idx = yt == 0;
yt(idx) = 1;
wx = yt .* real(n);
% figure
% plot(Sx,'b-')
% set(gca,'FontSize', 14)
% set(gcf, 'Position', [00, 00, 400, 300])
% set(gca,'xtick',[0,N/4,N/2,N/4*3,N])
% set(gca,'xticklabel',{'-0.5','-0.25','0','0.25','0.5'});
% axis([0 N -3.5 3.5])