Created
February 27, 2012 23:55
-
-
Save OlliV/1927989 to your computer and use it in GitHub Desktop.
Transmission Coefficient Calculator on Matlab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% ------------------------------------------------------------------------- | |
% | Transmission Coefficient Calculator | | |
% | =================================== | | |
% | Olli Vanhoja | | |
% | 2010-08-26 | | |
% | | |
% e_r1 e_r2 | | |
% mu_r1 mu_r2 | | |
% | | |
% P_in | tau | | |
% E_in -----> | --> P_tau | | |
% --- | | | |
% gamma ) | | | |
% P_refl <-- | | | |
% | | | |
% | | |
% ------------------------------------------------------------------------- | |
clear all | |
close all | |
close all hidden | |
clc | |
% Parameters | |
P_in = 1*10^-3; | |
e_r1 = 2.1; | |
mu_r1 = 1; | |
e_r2 = 1; | |
mu_r2 = 1; | |
% Constants | |
c_0 = 299792458; | |
mu_0 = 4*pi*10^-7; | |
e_0 = 1/(mu_0*c_0^2); | |
eta_1 = sqrt((mu_0*mu_r1)/(e_0*e_r1)); | |
eta_2 = sqrt((mu_0*mu_r2)/(e_0*e_r2)); | |
gamma = (eta_1-eta_2)/(eta_1+eta_2); % Reflection coefficient | |
%tau = (2*eta_2)/(eta_2+eta_1); % Transmission coefficient | |
tau = 1-abs(gamma); | |
P_refl = (gamma^2*eta_2)/(eta_1)*P_in; | |
P_tau = (tau^2*eta_1)/(eta_2)*P_in; | |
fprintf('P_in = %f W\neta_1 = %f ohm\neta_2 = %f ohm\n', P_in, eta_1, eta_2); | |
fprintf('gamma = %f\ntau = %f\ngamma+tau = %f\n', gamma, tau, abs(gamma)+tau); | |
fprintf('P_refl = %f\nP_tau = %f\n', P_refl, P_tau); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment