Abstract
This paper describes a public domain routine QPpassive.m for passivity enforcement of rational multi-port macromodels using constrained least squares approximation. The procedure calculates a correction to the original macromodel by adjusting the residues and constant term as a postprocessing step while minimizing the resulting change in the frequency domain. The code allows to reduce the computation time by limiting the number of free variables in the constraint problem. Different constraint types and weighting schemes are available. Copyright IEEE