Advertisement
Yuri-Cristhian

Untitled

Dec 17th, 2020
2,050
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scilab 0.37 KB | None | 0 0
  1. clc;
  2. k = 12;
  3. g = [1 1 0 0 0 1 1 1 0 1 0 1];
  4. c = zeros(2^k, 23);
  5. for i = 1:1:2^k
  6.     d = [];
  7.     aux = dec2bin(i - 1, k);
  8.     for j = 1:1:k;
  9.         if(part(aux, j) == '1')
  10.             d = [d 1];
  11.         else
  12.             d = [d 0];
  13.         end
  14.     end
  15.     c(i, :) = modulo(conv(d, g), 2);
  16.     peso(i) = sum(c(i, :));
  17. end
  18. peso = - gsort(-peso);
  19. dmin = peso(2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement