losstest.m

来自「国外教材MIMOSignalsAndSystems附带的程序」· M 代码 · 共 22 行

M
22
字号
% MATLAB function losstest.m checks out whether
% or not a Q-port network is lossless. For that
% purpose, the network's Q-by-Q scattering matrix, S,
% must be specified.
% Invocation of function test = losstest(S)
% yields a simple verbal statement about the
% existence or the absence of average power losses
% occurring in the network.

function [test] = losstest(S)
eps = 10^(-13);
Q = length(S);
if inv(S')-conj(S)< eps*ones(Q,Q)
   test = 0;
   disp('The network is lossless.')
   disp('Its scattering matrix S is a unitary matrix.') 
else
   test = 1;
   disp('The network is lossy.')
   disp('Its scattering matrix S is non-unitary.')
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?