% MATLAB Tutorial example of convolution matrix: "convmtx(b,n)".
% The example below computes the convolution matrix for a vector b
% in GF(4), representing the numerator coefficients for a digital filter.
% It then illustrates the two equivalent ways to convolve b with x over
% the Galois field.
m = 2;
b = gf([1 2 3]',m)
n = 3;
x = gf(randint(n,1,2^m),m)
C = convmtx(b,n) % Compute convolution matrix.
v1 = conv(b,x) % Use conv to convolve b with x
v2 = C*x % Use C to convolve b with x.
% The MathWorks Inc, Matlab7, (c) Copyright 1984-2004.