# Solve for input with given TransferFunctionModel

I obtained the transfer function for an electrical system from experimental data (left plot). Thereby, I can calculate the output voltage response for a given voltage input, using TransferFunctionModel[] and OutputResponse[] in the time domain (right plot): My question is, how can I use the obtained TransferFunctionModel to find the right voltage input pulse for a desired output voltage? I know from this publication, that for simple RC networks there is an analytical solution for this task, see for example Fig. 4(b) therein. As I'm not aware of an analytical solution for an arbitrary transfer function I was wondering if I could numerically solve for the required input (blue curve from above) if I want my output response to follow a specific function (green curve from above), e.g., Sin[x]^2.

I'm thinking that I might need to parametrize my possible input function somehow and then use Solve or NSolve to find the right parameters. However, I expect the required input to be of complex shape, i.e., not simply proportional to Sin[x]^2 like the blue curve above, and, thus, not sure how to parametrize it.

I really would appreciate comments or suggestions on how to proceed.

• A possible approach is to use the linearity and time invariance of the system. You decompose the desired output in a linear combination of delayed/advanced outputs like the one in orange, and then the required input is the same linear combination of the blue input (It's just a idea) – andre314 Oct 16 '17 at 20:05
• Otherwise the magnitude response in the frequency domain may correspond to differents impulse response, except if you do assumptions, for example assume that the system is made of lumped components and is of minimal phase response kind (in that case the bode relations are effective, and one can retrieve the phase, hence a unique transfert function) – andre314 Oct 16 '17 at 20:10

my solution. You can compute the inverse transferfuncion

PT2[K_, T1_, T2_] := K/((1 + T1 s) (1 + T2 s))
BodePlot[PT2[1, 1 10^-5, 10 10^-5], ImageSize -> Medium] Pinv[s_] = TransferFunctionModel[1/PT2[1, 1 10^-5, 10 10^-5], s]


Than you can pass your desired output through the artificial system and calculate the response

desOut[t_] := Sin[t]^2
resInput[t_] = OutputResponse[Pinv[s], desOut[t], t] // FullSimplify Now you can use this function as an input for the original system

P[s_] = TransferFunctionModel[PT2[1, 1 10^-5, 10 10^-5], s]

Plot[{Evaluate@OutputResponse[P[s], resInput[t], t], desOut[t]}, {t, 0, 10},
PlotStyle -> {Thick, Dashed}] • I tried finding the input numerically with NSolve, which worked as well to some extend. However, the quality of my results strongly depend on my basis for possible input functions i choose. Your approach works quite well for your transfer function. However, my transfer function is slightly more complex and thus the inverse diverges for high frequencies. But this can be avoided by introducing additional poles and so your answer helped me a lot to solve my problem. Thank you! – Matt Witt Oct 26 '17 at 8:35