Changed s2abcd() to take in vectors

s2abcd() takes in vectors for two-port s-parameters instead of a 2x2 matrix
This commit is contained in:
2026-02-25 02:49:54 -05:00
committed by GitHub
parent 21f6c1ae1f
commit 94541a1235

View File

@@ -816,11 +816,11 @@ classdef SPARAMS < handle
S = [S11 S12;S21 S22];
end
function [A, B, C, D] = s2abcd(S, Z0)
A = ((1 + S(1,1)).*(1 - S(2,2)) + S(1,2).*S(2,1))./(2.*S(2,1));
B = Z0*((1 + S(1,1)).*(1 + S(2,2)) - S(1,2).*S(2,1))./(2.*S(2,1));
C = (1/Z0)*((1 - S(1,1)).*(1 - S(2,2)) - S(1,2).*S(2,1))./(2*S(2,1));
D = ((1 - S(1,1)).*(1 + S(2,2)) + S(1,2).*S(2,1))./(2*S(2,1));
function [A, B, C, D] = s2abcd(S11, S12, S21, S22, Z0)
A = ((1 + S11).*(1 - S22) + S12.*S21)./(2.*S21);
B = Z0*((1 + S11).*(1 + S22) - S12.*S21)./(2.*S21);
C = (1/Z0)*((1 - S11).*(1 - S22) - S12.*S21)./(2*S21);
D = ((1 - S11).*(1 + S22) + S12.*S21)./(2*S21);
end
function [S11, S21, S12, S22] = abcd2s(A, B, C, D, Z0)