% This is a script designed for testing the passivity of N-port % S-parameters (In Touchstone format). It the standard passivity criterion % % Re{eigenvalues (I - S*S')} > 0 (Eq 1) % % The script works in conjunction with the SXPParse routine written by % Tudor Dima to read N-port Touchstone files into Matlab. % The script then checks condition (Eq1) for each frequency point and reports if it is violated. % In order to run the routine, first open your Touchstone S-parameter file % and make sure to delete all comments after the specifier line (# MHz etc). % The top of your file should look like following: % % ! ...all comments here, % ! on as many lines as you wish... % # MHZ S RI R 50.00 % % 50.000 0.076584 -0.033951 [...etc...] % % In line 47 of this file (PassivityTest.m), enter the file name of your % Touchstone file (...= SXPParse('FileName.s4p') % Save and Close the m-file. % Run PassivityTest.m % % This is a little fresh, so please let me know if you encounter any % problems. My contact info: % % Gourgen Oganessyan % Sr Electrical Engineer % Molex Inc., % Connector Products Division % 2222 Wellington Court % Lisle, IL 60532 % phone: (630)-527-4287 % fax: (630)-512-8620 % E-mail: goganessyan@molex.com % %Thanks to Brian O'Malley, Vince Cavanna, Ray Anderson and Tudor Dima for %original insights. % clear; nonpassive=0; [data_f, data, noise_f, noise, Zo] = SXPParse('Test.s4p'); [M N] = size(data_f); [L K] = size(data); for n = 1:N S = data(:, :, n); mineigv = min(real(eig(eye(size(S))-S*S'))); if mineigv < 0 sprintf('%s %0.5g %s %d' , 'Non-Passive at Freq=',data_f(n),' Hz min(Eigenval)=',mineigv) nonpassive=1; format short e; S elseif mineigv==0 sprintf('%s %0.5g %s %d' , 'Conditionally Passive at Freq=',data_f(n),' Hz ') nonpassive=1; format short e; S end; if nonpassive ~= 1 sprintf('%s','S-Parameter Matrix is Passive') end; end;