t = 1;        
k = pi / 4;   
E = 0.5;     


% Reflection coefficient B
B =  (E) / (-E  + 2 * 1i * t * sin(k));

% Transmission coefficient C
C = ( 2 * 1i * t * sin(k)) / (-E + 2 * 1i * t * sin(k));

%probability current on the left side (n < 0)
J_right = 2 * t * (1 - abs(B)^2) * k;

% the probability current on the right  side (n > 0)
J_left = 2 * t * abs(C)^2 * k;

% Scaling currents by 10^-15
J_right_scaled = J_right * 10^-15;
J_left_scaled = J_left * 10^-15;

fprintf('Reflection coefficient B: %f + %fi\n', real(B), imag(B));
fprintf('Transmission coefficient C: %f + %fi\n', real(C), imag(C));


fprintf('Probability current on the right side (J_right): %e\n', J_right_scaled);
fprintf('Probability current on the left side (J_left): %e\n', J_left_scaled);

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: