Satisfying the complex NxNxM requirement in s2rlgc function
Show older comments
Hello world,
I am trying to convert some s-parameters to the RLGC values using matlabs s2rlgc function. (It comes with the RF toolbox). However so far it has been able to do so for one individual value of s parameters. For example, I run the following script.
S_11 = 2.80007716585167 - 194.777061344490i;
S_12 = 1.01738305506126 + 0.00852418806674031i;
S_21 = 1.00027791458013 + 6.81079834005747e-07i;
S_22 = 10.1134655629712 + 0.881321459087057i;
freq = 40000000000;
% put the 4 s-parameters in a matrix
s_params = [S_11,S_12; S_21,S_22];
length = 4.5;
z0 =50;
sparams_passive = makepassive(all_s_params);
rlgc_params = s2rlgc(sparams_passive,length,freq,z0);
disp(rlgc_params)
and it will output
R: -9.3154
L: -2.5604e-10
G: 0.0036
C: 9.9513e-14
alpha: 1.2686
beta: -0.1837
Zc: 0.0012 -50.7238i
into the command window. The problem is that I have a 3202x2 complex double of s paramters since I took them in from a VNA(vector network analyzer; equipment from lab) As you can see from the line of code above, the S parameters form in 4 complex numbers, and so in the s_params matrix, they come out as a 3202x2 complex double. I also have a frequency 1601x1 double that corresponds with each set of s parameters.
I would love to run them all at once. When I try to do so I get error messages that say "S_PARAMS must be a complex NxNxM array."
I am not sure what is meant by NxNxM array. Does anyone have an idea?
8 Comments
David Goodmanson
on 28 Jun 2018
Hi Jesus,
Take a look at 'doc s2rlgc'. You have 1601 frequencies, and you need to make a 2x2x1601 array S, each layer of which is a 2x2 matrix [S11 S12; S21 S22] for that frequency. The 3202x2 array (call it A) has the values and it's just a question of how it is organized. For example if it looks like
S11 S12 freq 1
S21 S22 freq 1
S11 S12 freq 2
S21 S22 freq 2
...
then each layer of S is constructed from two rows of A, which can be accomplished with a for loop or otherwise.
Jesus Perez
on 28 Jun 2018
David Goodmanson
on 29 Jun 2018
Hi Jesus,
This looks like a favorable situation, where for loops are not necessary. If you preallocate S as zeros(2,2,1601) then for example for S11,
S(1,1,:) = A(1:1601,1). And so forth.
Jesus Perez
on 2 Jul 2018
David Goodmanson
on 2 Jul 2018
Hi Jesus,
S12 is in the second column of A, which is A(1:1601,2) and similarly S22 is in the second column which is A(1602:3202,2). Also there is a mistake on your last line where you meant S(2,2,:).
Jesus Perez
on 2 Jul 2018
Edited: Jesus Perez
on 2 Jul 2018
David Goodmanson
on 2 Jul 2018
I don't have the RF toolbox so I can't say much. I guess all I could suggest is
plot(abs(S(1,1,:)))
and
plot(angle(S(1,1,:)))
just to see if they make sense. And similarly for S(1,2,:) etc.
Jesus Perez
on 11 Jul 2018
Answers (1)
Martin
on 23 Feb 2019
Hi,
with the data in the following form
A = 1st value of array :[ S11 S12 ]
. .
the 1602nd value S21 S22
. .
3202 value of the array [ S21 S22 ]
I would use reshape like this
M = 1601; % size() or length() would be better
B = [A(1:M,1),A(M+1:end,1),A(1:M,2),A(M+1:end,2)].'; % Creates a Matrix of row vectors [s11;s21;s12;s22]
S = reshape(B,[2,2,M]); % creates NxNxM matrix from B
this should work as input for s2rlgc.
Categories
Find more on Data Import and Network Parameters 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!