Clear Filters
Clear Filters

How to cascade s parameter with different frequency vector (different range and step)

22 views (last 30 days)
I have two s parameters which has different frequency range and step and I want to cascade them. I'm getting error saying
Error using cascadesparams (line 75) All sparameter objects must use the same frequency vector and the same impedance value.
So what can I do? And I want to get s parameter beyond the overlap frequency band of the two, meaning I may need to do some extrapolation, how can I do that too? Thanks.

Answers (1)

Adee
Adee on 3 Nov 2021
Edited: Adee on 3 Nov 2021
The following seems to work for me (with RF toolbox):
%% concatenate two files
c1=rfckt.datafile; read(c1, 'file1.s4p')
c2=rfckt.datafile; read(c2, 'file2.s4p');
% resample the second file to the same frequency grid as the first file
analyze(c2, c1.AnalyzedResult.Freq);
% Alternatively: analyze(c1, c2.AnalyzedResult.Freq);
sp_c1 = sparameters(c1);
sp_c2 = sparameters(c2);
% if the original port order is the commonly used P1(1,3), P2(2,4),
% the ports must be reordered for cascading to work.
sp_c1.Parameters = snp2smp(sp_c1.Parameters, sp_c1.Impedance, [1 3 2 4]);
sp_c2.Parameters = snp2smp(sp_c2.Parameters, sp_c2.Impedance, [1 3 2 4]);
% Cascade
sp_cascade = cascadesparams(sp_dc1, sp_c2);
% reorder back
sp_cascade.Parameters = snp2smp(sp_cascade.Parameters, sp_cascade.Impedance, [1 3 2 4]);
rfwrite(sp_cascade, 'file3.s4p');
This code does not do any extrapolation. I am not sure how well it would work in general if you call the analyze(...) function with a frequency range that is not included in the data.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!