calculate relative error of two signals
So from the other post your error is:

$$
ERR = \sum \left | G_1(n) - G_2(n) \right|^2
$$

To calculate this should be quite simple. Do an element wise subtraction to get the difference between the two frequency responses at each point. Then square each element (magnitude squared if you have any imaginary components for some reason). Then sum over all the elements to get the total difference/error.

As mentioned in the other post you probably want to normalise this by the reference signal to make detecting abnormality easier.

Similarly you could just take the absolute difference rather than squaring. Squaring is more conventional though as it emphasises big differences more and is related to the variance.