First at all, this is trictly related to my own question: How to transform transfer functions into differential equations?
How can I transfer my differential equation into a transfer function?
For me (at the moment) the following works:
TimeDomain2TransferFunction[eqn_, y0_, u0_] :=
Solve[
LaplaceTransform[eqn, t, s] /. y0 /.
u0 /. {LaplaceTransform[y[t], t, s] -> Y[s],
LaplaceTransform[u[t], t, s] -> U[s]}
, Y[s]][[1, 1, 2]]/U[s]
So, let's say the differential equation is
sysEq = y'''[t] == -1/T2^2 y'[t] - T1/T2^2 y''[t] + Ki/T2^2 u[t]
Then the following gives me an satisfying result:
TimeDomain2TransferFunction[sysEq, {y[0] -> 0, y'[0] -> 0,
y''[0] -> 0}, {}]
ExpandDenominator[%]
Out: $\frac{\text{Ki}}{s \left(s^2 \text{T2}^2+s \text{T1}+1\right)}$
Out: $\frac{\text{Ki}}{s^3 \text{T2}^2+s^2 \text{T1}+s}$
Is there a more elegant way to do this? For example, for different letters (not only y and u).