0
$\begingroup$

I was reading this passage in a Doctoral Thesis about Adaptive cancellation.

enter image description here

Using MATLAB, if i were to write a simple code, it would look something like this.

transferFunction=tf(numerator,denominator);

%construction of impulse signal
dt=1e-3;
t = -1:dt:1;
impulse= t==0;

%computing impulse response
impulseResponse=fftshift(fft(lsim(transferFunction,impulse,t)));

I'm trying to understand the basics of how to calculate the numerator/denominator polynomials. so please bear with me when i explain how i visualize it. Lets assume the input to this linear time invariant system is a 1kHz sine wave sampled at 16 kHz.

Reading upon the function of 'tf' in MATLAB documentation, it says,

Transfer functions are a frequency-domain representation of linear time-invariant systems. For instance, consider a continuous-time SISO dynamic system represented by the transfer function sys(s) = N(s)/D(s), where s = jw and N(s) and D(s) are called the numerator and denominator polynomials, respectively. The tf model object can represent SISO or MIMO transfer functions in continuous time or discrete time.

If i take a 32 point FFT of that 1 kHz input signal, i'll have 16 bins with the 1 kHz at the 2nd bin.

Assuming there is a linear gain of 1 applied at every bin in the frequency domain. the output would be exactly the same as the input and therefore

N(s)/D(s) = S(x)

if the gain applied is 2 at every bin,

N(s)/D(s) = 2 S(x)

if the gain applied is 0.5 , then

N(s)/D(s) = S(x)/2

Is my understanding wrong ? if I'm wrong, how would you calculate the numerator and denominator polynomials of a system

  1. when you know the input and output of the system, and the gains applied.
  2. and when you know the input and output of the system, but NOT the gains applied.
  3. If the system is not linear, how does that tf function change?
$\endgroup$
2
  • 1
    $\begingroup$ You can't get a good transfer function estimate if you use 1 kHz sine was input. The input needs to contain sufficient energy at ALL frequencies. $\endgroup$
    – Hilmar
    Dec 7, 2021 at 12:53
  • $\begingroup$ yeah ZR Han below pointed that out. so I replaced the Sine wave with the White noise sampled at 16k. $\endgroup$ Dec 7, 2021 at 13:43

1 Answer 1

2
$\begingroup$

impulseResponse=fftshift(fft(lsim(transferFunction,impulse,t)));

This is kinda strange. Impulse response is a time-domain sequence, lsim(transferFunction,impulse,t) already gives you that and you don't need to do a FFT. You can also get IR using impz(numerator, denominator) if you know the numerator and denominator.

On the contrary, to estimate the numerator and denominator given the input and output of an unknown system, you can divide it into two steps,

  1. Estimate the impulse response of the system.

  2. Model the system using zero-pole model and then estimate the IIR coefficients.

The first step you can use adaptive filter such as LMS or NLMS (we call it system identification), or H1 estimator as the thesis mentioned, take FFT of input and output signal, and calculate $H_1(k)=\frac{Y(k)X^*(k)}{X(k)X^*(k)}$, take IFFT to get the impulse response.

The second step, given an impulse response of a LTI system, you can use prony() or stmcb() in MATLAB. You need to specify the order of the numerator and denominator polynomials respectively.

This method works whether the gain is applied or not, but the system must be linear. The input should be wideband signal within your desired frequency range, a mono-frequency sine wave is not a good choice, swept sine or white noise are good.

$\endgroup$
8
  • $\begingroup$ @ZR_Han took your advice and went with the H1 estimator approach, H_k = zeros(1,length(out_freq_data)); for ii=1:length(out_freq_data) num = out_freq_data(ii)*in_freq_data(ii)'; den = in_freq_data(ii)*in_freq_data(ii)'; H_k(ii) = num/den; end When i take the IFFT to check the impulse response (with linear gain or NO gain), the values of the impulse response are close to 0 , in the range of 10^-17 . is this expected have I done anything wrong with my implementation ? $\endgroup$ Dec 7, 2021 at 10:27
  • $\begingroup$ Plot the impulse response. You should see something like an impulse. $\endgroup$
    – ZR Han
    Dec 7, 2021 at 10:33
  • $\begingroup$ I did plot it. There is a peak at the DC component. But the remainder was more or less just flat with no 'impulse' like phenomenon. $\endgroup$ Dec 7, 2021 at 13:23
  • $\begingroup$ It seems that you are confused with impulse response $h(n)$ and frequency response $H(k)$, the former is in the time domain and therefore has no “DC component”, the latter is in the frequency domain. $\endgroup$
    – ZR Han
    Dec 7, 2021 at 13:30
  • 1
    $\begingroup$ I’ve already linked two hyperlinks for system identification using LMS algorithm and H1 estimator. If you need some further reading for IIR modeling of an FIR, you can have a look at the documentation of prony and stmcb in MATLAB, that will help and contains references. $\endgroup$
    – ZR Han
    Dec 7, 2021 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.