%% Use Behavioral Model to Calculate S-Parameters of Microstrip Cross
% Design a microstrip transmission line at 3 GHz for FR4 substrate.

d = dielectric('FR4');
d.LossTangent = 0;
m = design(microstripLine('Substrate',d),3e9,'Z0',75,...
    'LineLength',0.5);

%
% Create a microstrip cross.

layer2d = traceCross('Length',[m.Length m.Length], ...
    'Width',[m.Width m.Width]);

%
% Convert the cross trace to a PCB component.

robj = pcbComponent(layer2d);
robj.BoardThickness = m.Substrate.Thickness;
robj.Layers{2} = m.Substrate;
show(robj)

%
% Define frequency points to calculate the s-parameters.

freq = (1:3:40)*100e6;

% Calculate the s-parameters of the cross trace using the behavioral model.

Sckt = sparameters(robj,freq,'Behavioral',true);

% Calculate the s-parameters of the cross trace using the electromagnetic solver.

Sem = sparameters(robj,freq);

% References:
% Ramesh Garg & I. J. Bahl (1978) Microstrip discontinuities, International Journal of Electronics, 45:1, 81-87, DOI: 10.1080/00207217808900883
%  Wadell, Brian C. Transmission Line Design Handbook. The Artech House Microwave Library. Boston: Artech House, 1991.
% Copyright 2020 The MathWorks, Inc.