# Finding the Transfer Function of a Multiplicative Distortion in MATLAB

I have the frequency response of two signals shown above. One is uncontaminated, and the other is the same signal contaminated by a multiplicative distortion with two poles and two zeros. I need to find/estimate the transfer function values of the contaminating filter in order to equalize the contamination. How do I accomplish this in MATLAB? Thanks.

• Multiplicative in Frequency Domain or Time Domain? I guess in frequency but it is better to explicitly say it. As then it is not a multiplicative distortion but a Filter. – Royi Dec 6 '20 at 5:38
• Can you share a CSV file with your measurements? – Royi Dec 7 '20 at 5:31
• Can you please review and mark my answer? – Royi Dec 16 '20 at 5:17

Basically the transfer function is given by (Continuous time case):

$$H \left( j \omega \right) = K \frac{ \left( j \omega - {q}_{1} \right) \left( j \omega - {q}_{2} \right) }{ \left( j \omega - {p}_{1} \right) \left( j \omega - {p}_{2} \right) }$$

Now, given your frequency data sampled an $$N$$ points $${\left\{ {\omega}_{i} \right\}}_{i = 1}^{N}$$ we need to use the discrete-time form of the transfer function over the Z domain (Z Transform).
Hence the model becomes:

$$H \left( z \right) {\mid}_{z = {e}^{j \omega}} = K \frac{ \left( z - {q}_{1} \right) \left( z - {q}_{2} \right) }{ \left( z - {p}_{1} \right) \left( z - {p}_{2} \right) }{\Bigg|}_{z = {e}^{j \omega}} = K \frac{ \left( {e}^{j \omega} - {q}_{1} \right) \left( {e}^{j \omega} - {q}_{2} \right) }{ \left( {e}^{j \omega} - {p}_{1} \right) \left( {e}^{j \omega} - {p}_{2} \right) }$$

you may set a system of $$N$$ complex equations and use non linear solver to find the 5 parameters ($$K$$, $${q}_{1}$$, $${q}_{2}$$, $${p}_{1}$$, $${p}_{2}$$) you need.

In case the measurements are noisy you may use Least Squares.

Remark
The above solves the problem from the data of @jmcd in frequency domain. In practice, using the data domain one could use simpler System Identification (See System Identification: An Overview) methods to get the equivalent ARMA model.
Regarding Frequency Domain based methods for System Identification have a look at Rik Pintelon - System Identification: A Frequency Domain Approach.

• is this problem in continuous time or discrete time? $s$ domain or $z$ domain? – robert bristow-johnson Dec 6 '20 at 19:33
• You are right, I should have used a domain syntax to be clearer. – Royi Dec 6 '20 at 20:47
• but Royi, the question is still there. it's pretty clear to me that you are suggesting an answer (i think it's sorta a partial answer because no final solution is given, even with the Least Squares, but that's fine) that is in the continuous-time domain ($H(s)\Big|_{s=j\omega}$). perhaps the transfer function the OP is looking for is in the discrete-time domain $H(z)\Big|_{z=e^{j\omega T}}$. that will be a slightly different looking frequency response and the LS algorithm might come up with different poles and zeros (given the mapping $z=e^{sT}$). – robert bristow-johnson Dec 7 '20 at 3:43
• may i modify your answer to cover both bases? – robert bristow-johnson Dec 7 '20 at 3:45
• Yes, of course. I'd be honored. – Royi Dec 7 '20 at 5:22