Transfer matrix method for plasmonics
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
SCIUSCIA
el 17 de Oct. de 2021
Respondida: Vidhi Agarwal
el 25 de Sept. de 2024
I run the shared the jreftran.m which has been designed for two layers:
delta=1i*g.*d.*ct;
M=zeros(2,2,length(d));
for j=1:length(d)
M(1,1,j)=cos(delta(j));
M(1,2,j)=1i./eta(j).*sin(delta(j));
M(2,1,j)=1i*eta(j).*sin(delta(j));
M(2,2,j)=cos(delta(j));
end
M_t=[1,0;0,1]; %M total
for j=2:(length(d)-1)
M_t=M_t*M(:,:,j);
end
But I intend to move to three or more layers using the same matrix method.
0 comentarios
Respuesta aceptada
Vidhi Agarwal
el 25 de Sept. de 2024
Hi @SCIUSCIA
By multiplying the matrices corresponding to each layer, you can adapt the code to handle three or more levels by iterating over all layers using the matrix approach. Making sure that the matrix multiplication accurately adds up each layer's impact on the overall transfer matrix is crucial.
The modified code for three or more layers with matrix multiplication will be:
delta = 1i * g .* d .* ct;
num_layers = length(d);
% Initialize the layer matrices
M = zeros(2, 2, num_layers);
% Compute the matrix for each layer
for j = 1:num_layers
M(1, 1, j) = cos(delta(j));
M(1, 2, j) = 1i / eta(j) * sin(delta(j));
M(2, 1, j) = 1i * eta(j) * sin(delta(j));
M(2, 2, j) = cos(delta(j));
end
% Initialize the total matrix as the identity matrix
M_t = eye(2);
% Multiply the matrices for all layers
for j = 1:num_layers
M_t = M_t * M(:, :, j);
end
% Now M_t is the total transfer matrix for the entire stack of layers
Hope that Helps!
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!