# Knowing the transfer function of a system and the output, how can I get the input?

I have a system composed by k-thermocouple + metal handpiece, the thermocouple is drowned into the handpiece. If I manage to estimate a transfer function of the system so-made, for example trough several step and ramp response, is it possible to get an approximation of the real temperature? If I briefly recall the system theory, we have that: y(s)=x(s)h(s), where

• h(s) is the transfer function
• y(s) is the output ( the read temperature)
• x(s) is the input ( the real temperature)

As a student, I'm used to manage the "unknown" as the output y(s)...but in this case, I know the output (because I read it from the thermocouple) and I know the transfer function (because I've characterized the system), what I need is the input.

Mathematically speaking the answer is easy: x(t)=inverseLT(y(s)/h(s)) , but practically how can I obtain this? With a real-time measuring system, for example microcontrollers? The first step is to convert the h(s) into the equivalent discrete time h(z), of course, but then? I need to find the frequency response? And so, the final question: why do I need the response of the system when sinusoidal inputs are applied if the system will never experience such inputs in real life usage?

• The book Numerical Recipes talks about exactly this kind of control problem. Do you have a copy? It's an inherently 'noisy' step since in a sense division is taking place. But it is workable. May 2 at 23:03
• Even mathematically, it's not quite as easy as inverting Y(s)/H(s) because that assumes zero initial state for H(s), which is practically not going to be the case for a thermal system. If the metal was red hot when the hand grabbed it, you'll get a different output than if the same hand grabbed it when it was cool, but that information is not contained in H(s). There are smaller effects like ambient temperature would need to be modeled as a second input to the system if you need high accuracy.
– Eeyn
May 2 at 23:20
• @periblepsis thanks for the recommendation, i'll look forward to get the book. I've never heard about May 3 at 19:35
• @Eeyn of course i've oversimplified the question, and i agree with you May 3 at 19:36

Since you have the filter $$\H(s)\$$, and can turn it into a Z-domain equivalent $$\H(z)\$$, then I believe that nothing is stopping you from calculating the inverse filter $$\H^{-1}(z)\$$. Then you might want to implement an extra factor $$\z^{-n}\$$ to turn it into a causal filter again.

So you would effectively calculate the input in real-time.

$$U'(z) = z^{-n}\cdot H^{-1}(z)\cdot Y(z) = z^{-n}\cdot H^{-1}(z)\cdot (H(z)\cdot U(z)) = z^{-n}\cdot U(z)$$

I think it should be possible to implement the filter $$\z^{-n}\cdot H^{-1}(z)\$$ in the sample domain, allowing it to be implemented fairly easily on a microcontroller as the samples come in.

This is akin to deconvolution, and often this operation is very unfriendly to noise. If your output is noisy, then the result of this operation will likely blow up that noise.

How you deal with that noise is probably up to you and the application. You could try applying a low-pass filter if you are only interested in low-frequency information for example.

And so, the final question: why do I need the response of the system when sinusoidal inputs are applied if the system will never experience such inputs in real life usage?

Usually sinusoidal inputs only come in for characterizing the system, i.e. figuring out $$\H(s)\$$. The nice property about sinusoidal inputs is that they are spectrally pure, so it allows us to measure a single point of $$\H(s)\$$ without contamination (provided the system is linear of course).

• something lights up in my mind, but i had to try it before singing victory. I will update on the outcome May 3 at 19:45