How to use a for loop in matlab to take consecutive 972 bits out of a 1 by 9999980 bits matrix ?

1 visualización (últimos 30 días)
In the following code, I have a u matrix of 1 by 9999980 size. I have to take consecutive 972 bits of this u matrix, to use in following expressions of p1, p2, and c.
p1 = mod(phi*xtra*(u'),2)';
p2 = mod(invt*(a*(u') + b*(p1')),2)';
c = [u p1 p2];
My question is how I should write for loop to complete above tasks ?

Respuestas (1)

Walter Roberson
Walter Roberson el 31 de Ag. de 2021
Nbit = 972;
Koffset = randi([0 length(u) - Nbit]);
for K = 1 : Nbit
p1 = mod(phi*xtra*(u(K+Koffset)'),2)';
p2 = mod(invt*(a*(u(K+Koffset)') + b*(p1')),2)';
c(K,:) = [u(K+Koffset) p1 p2];
end
  3 comentarios
Walter Roberson
Walter Roberson el 31 de Ag. de 2021
buffer() from the Communications System Toolbox. Or blockproc() from Imsge Processing Toolbox

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by