%% Suspended Microstrip Design and S-Parameters
% This example shows how to design a suspended microstrip line at 3 GHz for a Teflon substrate, copper conductor, line length of 0.5\lambda, reference impedance of 75\Omega, and the following ratio:
% \frac{\textrm{Thickness}\;\;\textrm{of}\;\textrm{the}\;\textrm{air}\;\textrm{layer}}{\textrm{Thickness}\;\;\textrm{of}\;\textrm{the}\;\textrm{substrate}}=\frac{8e-4}{8e-4}=1
% Compare S-parameters obtained from EM and behavioral modeling when the transmission line is terminated with 50\Omega.
%% Design Suspended Microstrip
% Use the dielectric and the metal libraries to create a suspended prototype microstripLine.

dFR4 = dielectric('Teflon');
dFR4.Thickness = 8e-4;
dAir = dielectric('Air');
dAir.Thickness = 8e-4;

dSuspended = dielectric('Name',{dAir.Name, dFR4.Name},...
    "EpsilonR",[dAir.EpsilonR dFR4.EpsilonR], ...
    "LossTangent",[dAir.LossTangent dFR4.LossTangent],...
    "Thickness",[dAir.Thickness dFR4.Thickness]);
suspendedPrototype = microstripLine('Substrate',dSuspended, ...
    'Conductor',metal('Copper'),...
    "Height",dAir.Thickness+dFR4.Thickness);
show(suspendedPrototype)

% Use design function to obtain the transmission line.

tx = design(suspendedPrototype,3e9,'Z0',75,'LineLength',0.5);
show(suspendedPrototype)

%% Plot S-parameters

freq = (1:40)*100e6;
Sem = sparameters(tx,freq,50);
Srf = sparameters(tx,freq,50,'Behavioral',true);
rfplot(Sem,'-x','db')
hold on
rfplot(Srf,'-s','db')
title('EM S vs. behavioral S abs, freq=(1:40)*100e6')

% Copyright 2020 The MathWorks, Inc.