Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Mar 31st, 2020 147 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. clc
  2. close
  3. clear
  4.  
  5. X = audioread('ATrain.wav');
  6. X = double(X);
  7. X = floor(X * 2^15 + 0.5);
  8. L1 = X(:,1);
  9. P1 = X(:,2);
  10.  
  11. [x,y] = size(X);
  12.  
  13. L = zeros(x,1);
  14. P = zeros(x,1);
  15. L(1) = L1(1);
  16. P(1) = P1(1);
  17. DL = zeros(2*(2^16)-1,1);
  18. DP = zeros(2*(2^16)-1,1);
  19. [x1,y2] = size(DL);
  20.  
  21. for i= 2:x
  22.     L(i) = L1(i) - L1(i-1);
  23.     P(i) = P1(i) - P1(i-1);
  24. end
  25.  
  26. for i = 1:x
  27.     if L(i) < 0
  28.         DL(L(i) + 65536 ) = DL(L(i) + 65536 ) + 1;
  29.     else
  30.         DL(L(i) + 65536 ) = DL(L(i) + 65536 ) + 1;
  31.     end
  32.    
  33.     if P(i) < 0
  34.         DP(P(i) + 65536 ) = DP(P(i) + 65536 ) + 1;
  35.     else
  36.         DP(P(i) + 65536 ) = DP(P(i) + 65536 ) + 1;
  37.     end
  38. end
  39.  
  40. PL = DL/x;
  41. PP = DP/x;
  42.  
  43. SL = 0;
  44. SP = 0;
  45. for i = 1:x1
  46.    if PL(i) ~= 0
  47.        SL = SL + (PL(i) .* log2(PL(i)));
  48.    end
  49.    
  50.    if PP(i) ~= 0
  51.        SP = SP + (PP(i) .* log2(PP(i)));
  52.    end
  53. end
  54. l = -SL;
  55. p = -SP;
  56. fprintf('Entropia lewego kanału po kodowaniu: %f\n', l)
  57. fprintf('Entropia prawego kanału po kodowaniu: %f\n', p)
  58. fprintf('Srednia arytmetyczna lewego i prawego kanalu: %f\n', (p+l)/2)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top