From 94541a12356e7775a33bdc59c1a2251928c7065a Mon Sep 17 00:00:00 2001 From: Nathan Chordas-Ewell Date: Wed, 25 Feb 2026 02:49:54 -0500 Subject: [PATCH] Changed s2abcd() to take in vectors s2abcd() takes in vectors for two-port s-parameters instead of a 2x2 matrix --- SPARAMS.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SPARAMS.m b/SPARAMS.m index 4388d9b..3c16777 100644 --- a/SPARAMS.m +++ b/SPARAMS.m @@ -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)