1
0

permutations.m 912 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. function perm=permutations(xc,sc)
  2. % Identification of the source permutations between the true and estimated
  3. % contributions tensors xc and sc
  4. %
  5. % Inputs
  6. % xc : tensor whose element xc(i,j,:) is the true contribution of the j^th
  7. % source in the i^th sensor
  8. % sc : tensor whose element sc(i,j,:) is the estimated contribution of the
  9. % j^th permutated source in the i^th sensor
  10. %
  11. % Ouput
  12. % perm : permutation vector
  13. for r=1:size(xc,2)
  14. s1(:,1,:)=xc(:,r,:);
  15. s2(:,:,:)=sc(:,:,:);
  16. perm(r)=ident(s1,s2);
  17. end
  18. %--------------------------------------------------------------------------
  19. function [i]=ident(s1,s2)
  20. for r=1:size(s2,2)
  21. sir1(r)=0;
  22. for k=1:size(s1,1);
  23. sir1(r)=max(sir(s1(k,1,:),s2(k,r,:)),sir1(r));
  24. end
  25. end
  26. [SIR,i]=max(sir1);
  27. %--------------------------------------------------------------------------
  28. function sir1=sir(s1,s2)
  29. sir1=10*log10(mean(s1.^2)/mean((s1-s2).^2));