How to obtain the bandwidth from an sparameters() imported file?
Show older comments
When it comes to antennas, we require the bandwidth from obtained S11 readings, preferably below -10dB (Click here for more info). This is the frequency range at which the reflection coefficient is less than a certain magnitude (in most cases -10dB). The S11 plot can easily be generated using the code shown below. I will attach this .s1p file.
S = sparameters('50.s1p');
rfplot(S);
Which will give a plot as shown below.

Is there a Matlab code which will display the bandwidth for frequencies with magnitude less than -10dB? If I can atleast find out what the magnitude is at a specific frequency, I can calculate the bandwidth myself.
Answers (1)
Vinod Dwarapudi
on 15 Jul 2026 at 11:34
Hi Chamath Vithanawasam
The sample code below is intended for single-band antennas. It identifies the −10 dB S11 crossing frequencies and computes the corresponding impedance bandwidth. If no valid −10 dB crossings are found, the bandwidth is reported as zero.
bw = computeBandwidth("50.s1p")
bw =
1.0848e+08 Hz
>> sp = sparameters('50.s1p')
sp =
sparameters with properties:
Impedance: 50
NumPorts: 1
Parameters: [1×1×1001 double]
Frequencies: [1001×1 double]
We can see that the S-parameter data contains 1001 frequency points, which should be sufficient for accurate bandwidth computation in most cases. If the number of frequency points is lower, interpolation can be enabled to obtain more accurate estimates of the −10 dB crossing frequencies and, consequently, the impedance bandwidth.
>> bw = computeBandwidth("50.s1p",'Interpolation',10000)
bw =
1.0848e+08 Hz
function [bw, f_lower, f_upper, f_res] = computeBandwidth(filename, varargin)
% computeBandwidth Compute -10 dB impedance bandwidth from an S1P file.
%
% [bw, f_lower, f_upper, f_res] = computeBandwidth(filename)
%
% [bw, f_lower, f_upper, f_res] = computeBandwidth(filename, ...
% 'InterpolationPoints', N)
%
% Inputs
% -------
% filename : string | char
% Touchstone .s1p file.
%
% Name-Value Pairs
% ----------------
% InterpolationPoints : positive integer
% Number of points used for interpolation.
% Default: [] (no interpolation).
%
% Outputs
% -------
% bw : Bandwidth in Hz.
% f_lower : Lower -10 dB crossing frequency (Hz).
% f_upper : Upper -10 dB crossing frequency (Hz).
% f_res : Resonant frequency corresponding to minimum S11 (Hz).
%
% Notes
% -----
% * Intended for single-band antennas.
% * If no valid -10 dB crossings exist, bandwidth is reported as zero.
p = inputParser;
addParameter(p, 'InterpolationPoints', [], ...
@(x) isempty(x) || (isscalar(x) && x > 1));
parse(p, varargin{:});
nInterp = p.Results.InterpolationPoints;
threshold = -10;
sparam = sparameters(filename);
freq = sparam.Frequencies(:);
s11dB = 20*log10(abs(rfparam(sparam,1,1)));
% Resonant frequency
[~, idxMin] = min(s11dB);
f_res = freq(idxMin);
% Optional interpolation
if ~isempty(nInterp)
freqOrig = freq;
s11Orig = s11dB;
freq = linspace(freqOrig(1), freqOrig(end), nInterp).';
s11dB = interp1(freqOrig, s11Orig, freq, 'pchip');
end
below = s11dB <= threshold;
if ~any(below)
bw = 0;
f_lower = 0;
f_upper = 0;
return;
end
crossings = diff(below);
downIdx = find(crossings == 1, 1, 'first');
upIdx = find(crossings == -1, 1, 'last');
%% Lower crossing
if below(1)
% Band starts before sweep range
f_lower = freq(1);
elseif ~isempty(downIdx)
f_lower = interpolateCrossing( ...
freq(downIdx), freq(downIdx+1), ...
s11dB(downIdx), s11dB(downIdx+1), ...
threshold);
else
bw = 0;
f_lower = 0;
f_upper = 0;
return;
end
%% Upper crossing
if below(end)
% Band extends beyond sweep range
f_upper = freq(end);
elseif ~isempty(upIdx)
f_upper = interpolateCrossing( ...
freq(upIdx), freq(upIdx+1), ...
s11dB(upIdx), s11dB(upIdx+1), ...
threshold);
else
bw = 0;
f_lower = 0;
f_upper = 0;
return;
end
bw = max(0, f_upper - f_lower);
end
function fc = interpolateCrossing(f1, f2, s1, s2, threshold)
fc = f1 + (threshold - s1) * ...
(f2 - f1) / (s2 - s1);
end
Categories
Find more on Get Started with Antenna Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!