C = CodingGain(A); CodingGain(vars) returns the coding gain of a subband coding system of M channels, where vars is an M-element vector of powers. CodingGain(R) returns the coding gain of a subband coding system of M channels, R is an MxMxL matrix expressing the polynomial covariance matrix of the subchannels. The coding gain is the ratio between arithmetic and geometric mean of the subband variances. Input parameter: vars or R vector of subband powers / variances, or polynomial covariance matrix Output parameter: C coding gain
0001 function C = CodingGain(A); 0002 %C = CodingGain(A); 0003 % 0004 % CodingGain(vars) returns the coding gain of a subband coding system of M 0005 % channels, where vars is an M-element vector of powers. 0006 % 0007 % CodingGain(R) returns the coding gain of a subband coding system of M 0008 % channels, R is an MxMxL matrix expressing the polynomial covariance matrix 0009 % of the subchannels. 0010 % 0011 % The coding gain is the ratio between arithmetic and geometric mean of the 0012 % subband variances. 0013 % 0014 % Input parameter: 0015 % vars or R vector of subband powers / variances, or 0016 % polynomial covariance matrix 0017 % 0018 % Output parameter: 0019 % C coding gain 0020 0021 % S. Weiss, 25/8/2014 0022 0023 [M,N,L] = size(A); 0024 if (L==1) && ((M==1)||(N==1)), 0025 J = max(M,N); 0026 C = (sum(A)/J) / ((prod(A)).^(1/J)); 0027 elseif M==N, 0028 L2 = (L+1)/2; 0029 A = diag(A(:,:,L2)); 0030 C = (sum(A)/M) / ((prod(A)).^(1/M)); 0031 else 0032 error('input to CodingGain() does not satisfy the required dimensions'); 0033 C=-1; 0034 end; 0035