# Get the greatest time contant of a system's output given its expression

Let $$y(t)$$ be a function that consists of a sum of terms, each of which is in general a product of an exponential function $$e^{\sigma t}$$, and a sine function $$\sin{\omega t}$$ or cosine function $$\cos{\omega t}$$ with some amplitude (it could also have a potential function $$t^n$$, but for the sake of simplicity let's assume $$y$$ has no terms with such factor). So $$y$$ has the general form

$$y(t) = 2 e^{\sigma_1 t} (a_1 \cos{\omega_1 t} + b_1 \sin{\omega_1 t}) u(t) + 2 e^{\sigma_2 t} (a_2 \cos{\omega_2 t} + b_2 \sin{\omega_2 t}) u(t) + \cdots$$

In other words, $$y$$ is the output of a continuous LTI system with no repeated poles.

My question is, how do we get the greatest time constant of the output, assuming the system is stable with a bounded input?

My proposed solution: Since we know the expression of $$y(t)$$, one way I think of tackling this problem is by following these steps:

1. Get each term of $$y$$. This results in a list $$\{ 2 e^{\sigma_1 t} (a_1 \cos{\omega_1 t} + b_1 \sin{\omega_1 t}) u(t), 2 e^{\sigma_2 t} (a_2 \cos{\omega_2 t} + b_2 \sin{\omega_2 t}) u(t), \dots \}$$
2. For each term, identify/get the exponential factor. This results in a list $$\{ e^{\sigma_1 t}, e^{\sigma_2 t}, \dots \}$$.
3. For each exponential factor, get the coefficient of the exponent (i.e. the Neper frequency). This results in a list $$\{ \sigma_1, \sigma_2, \dots \}$$.
4. For each Neper frequency, get the negative of the inverse of it. This results in a list of $$\{ \tau_1, \tau_2, \dots \}$$, where $$\tau_i = -1/ \sigma_i$$.
5. Get the greatest time constant. This results in $$\tau_{\text{max}}$$.

While this algorithm is pretty descent for the kind of systems I'm studying, my problem is I don't know how to implement/code this. Do you know how? Or do you know another way? For the last step though, we could use the Max[] function of Mathematica.

EDIT: As an example, consider the output

$$y(t) = [1 - 0.14 e^{-2.59 t} + 0.16 e^{-0.31 t} - 2 e^{-0.05 t} (0.51 \cos{0.95 t} + 0.20 \sin{0.95 t})] u(t)$$

All of the coefficients of the exponents of exponential factors are non-positive, so the output is bounded and we can use the algorithm. After applying steps 1 to 3, Mathematica should get the list {-2.59, -0.31, -0.05}. For step 4, it gets the inverse of each element of the list and multiplies it by -1, getting the list {0.39, 3.23, 20}. For step 5, the Max[] function applied to the previous list should return 20, which is the greatest time constant of the output.

By the way, I just realized we can make the algorithm a bit more efficient. Change step 4 as: "Get the Min[] of the list obtained in step 3." And change step 5: "Get the inverse of the minimum element obtained and multiply it by -1."

• it will be easier to answe if you show a MWE of an actual expression to use to test with with any concrete values they might have. – Nasser May 2 at 5:52
• @Nasser I've added an example. – Alejandro Nava May 2 at 6:30

ClearAll[y, t, x, u];
y[t_] := (1 - 0.14*Exp[-2.59*t] + 0.16*Exp[-0.31*t] -
2*Exp[-0.05*t]*(0.51*Cos[0.95*t] + 0.2*Sin[0.95*t]))*u[t];

getPatterns[expr_, pat_] := Last[Reap[expr /. a:pat :> Sow[a], _, Sequence @@ #2 & ]];

(*r = getPatterns[y[t], Exp[x__]];*)
r = getPatterns[y[t], Exp[_. t + _.]]; (*may be better*) If[Length[r] > 0, Max[Cases[r, Exp[(x_.)*t] :> -x^(-1)]]]
(*20*)


The function getPatterns above is thanks to Carl Woll