Reputation: 63
If I have a normal matrix A
that I convert to a GF(2) using the MatLab gf
function to produce a GF(2) object A_g
and then perform operations on A_g
like FEC encoding and reshaping to produce B_g
can I easily convert B_g
to a normal matrix object B
using some inverse function of gf
Something like this:
A = [0, 1, 1, 0]
A_g = gf(A)
B_g = bchenc(dataIn, 7, 4);
B = gfinv(B_g) % does gfinv exist?
% now do digital modulation on B
Upvotes: 1
Views: 158
Reputation: 63
I managed to convert B_g
to B
by iterating over each element in the Galois array as follows:
[rows, cols] = size(B_g); % get dimensions of B_g
B = zeros(rows, cols); % declare B with same dimensions
for row = 1:rows
rowGF = B_g(row,:);
for col = 1: cols
if (rowGF(col)/1) == 1 % if the element is 1 then set to 1
B(row, col) = 1;
elseif (rowGF(col)/1) == 0 % if the element is 0 then set to 0
B(row, col) = 0;
end
end
end
Not sure if there's an inbuilt way of doing this, but this is good enough.
Upvotes: 1