Output of Zero-forcing equalizer doesn't match theoretical calculations Let's say I have a sequence $x[n]$ (signal) and perform convolution with another sequence $h[n]$ (channel), so:
$$
y[n] = h[n]*x[n] = \sum_{k}{h[k]x[n-k]} \leftrightarrow Y(z) = H(z)X(z)
$$

I'm looking for $C(z)$ such that:
$$
C(z)= \frac{1}{H(z)}
$$

So that I can compensate the channel:
$$
c[n]*y[n] = \sum_{k}{c[k]y[n-k]} \leftrightarrow C(z)Y(z) = \frac{1}{H(z)}Y(z) = 
 \frac{1}{H(z)}H(z)X(z) = X(z)
$$

Let's assume I know the channel $h[n]$ and I use that to obtain $c[n]$ using Zero-Forcing equalization.

My question is, if I do:

x = [1 2 3 4 5 6 7];
h = [1 0.9 0.3];
c = zeroforcing(h); % c=[-4.7619, 4.2857, -1.4286]

y = filter(h,1,x);
x_d = filter(c,1,y);


Shouldn't x_d be a delayed version of x ? But I don't seem to get that in my simulations.

(The way I obtain c is converting h to a toeplitz matrix and doing $c[n]=H^{-1}\delta [n]$ as explained here:

$$
\begin{bmatrix}
c_1 \\ c_2 \\ c_3
\end{bmatrix}
=
\begin{bmatrix}
h_2 &amp; h_1 &amp; 0 \\
h_3 &amp; h_2 &amp; h_1 \\
0 &amp; h_3 &amp; h_2
\end{bmatrix}^{-1}
\begin{bmatrix}
0 \\ 1 \\ 0
\end{bmatrix}
=
\begin{bmatrix}
0.9 &amp; 1 &amp; 0 \\
0.3 &amp; 0.9 &amp; 1 \\
0 &amp; 0.3 &amp; 0.9
\end{bmatrix}^{-1}
\begin{bmatrix}
0 \\ 1 \\ 0
\end{bmatrix}
$$
It seems like there might be something weird going on with that blog, but I only quickly looked. Here is the idea for the ZF equalizer:


Figure out the convolution matrix.


convMatrix = convmtx(h, length(x));

This will be a $9 \times 7$ matrix because the input vector $\mathbf{x}$ is length 7 and the output convolution will be of length $7+3-1=9$. It is not a square matrix but we can still get an inverse by computing the Moore-Penrose inverse (https://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_inverse), which in MATLAB can be done by calling:

invConvMatrix = pinv(convMatrix);. 


Choose your delay. invConvMatrix is a $7 \times 9$ matrix and we are multiplying with an all zero vector except for a single one at some delay $\mathbf{\delta}$. Lets choose the delay to be 5, so we have:
$\mathbf{\delta}=[0, 0, 0, 0, 1, 0, 0, 0, 0]^T$.
Compute the ZF equalizer:


 zfEqualizer = invConvMatrix * d;


Generate the received signal, and generate signal after equalization


 y = conv(h, x);
  z = conv(zfEqualizer, y);

Now lets take a look at the resulting signals, and specifically notice where the equalized signal starts, right at the delay of 5 that we choose earlier. I hope this helps.