function [T A B E F D C H]=U_antena(fres2, fres3, fres4, eps_r, T)
% fres2 the lower limit of the desired frequency range  [Hz]
% fres3 central frequency [Hz]
% fres4 the higher limit of desired frequency range [Hz]
% eps_r desired permittivity substrate.
% T     desired substrate thickness [mm].

c0=3*10^8; % speed of light in vacuum
lambda_res3=c0/fres3;

% Select a substrate permittivity and substrate thickness
% control of availability of the requirement
T_test=0.06*(lambda_res3/sqrt(eps_r));

if T>= T_test
else T_test=T
end

% Estimate the quantity B+2deltaB 
B_dve_delta_B = c0/(2*(sqrt(eps_r))*fres3);

% Calculate of the width of the patch A
A=1.5*(B_dve_delta_B)

% Calculate of the effective permitivity eps_eff and parameter 2deltaB
eps_eff=((eps_r+1)/2)+((eps_r-1)/2)*sqrt(1+((12*T)/A));
dve_delta_B=0.824*T*((eps_eff+0.3)*((A/T)+0.262)/((eps_eff-0.258)*((A/T)+0.813)));

% Backcalculate of the length of the patch B
B=(c0/(2*sqrt(eps_eff)*fres3))-dve_delta_B

% Select a starting value of slot thickness E and F
E=lambda_res3/60
F=E

% Calculate width of  U-slot D
D=(c0/(sqrt(eps_eff)*fres2))-(2*(B+dve_delta_B-E))

% Select C such that
C1=0.33*A;
C2=0.9*D;

% Calculate the effective permittivity and effective length extension of
% the pseudopatch of the fourth resonance with effective patch width as
% D-2F 
eps_eff_PP=((eps_r+1)/2)+((eps_r-1)/2)*sqrt(1+((12*T)/(D-2*F)));
dve_delta_B_E_H=0.824*T*((eps_eff_PP+0.3)*(((D-2*F)/T)+0.262)/((eps_eff_PP-0.258)*(((D-2*F)/T)+0.813)));

% Estimate of the position U-slot
H=B-E+dve_delta_B_E_H-(1/sqrt(eps_eff_PP))*((c0/fres4)-(2*C1+D))

% Check that sum C+E+H is less than B. If not adjust C by changing the
% rations in step 9 and value of H until the design is physically realizable. 
if C1+E+H<=B 
else C1=C2
H=B-E+dve_delta_B_E_H-(1/sqrt(eps_eff_PP))*((c0/fres4)-(2*C1+D)) 
end
C=C1

end