Salta al contenuto
Note per Studenti Time-Domain Solution of ODEs Report

Time-Domain Solution of ODEs

In questa pagina 8

Control systems are often described by differential equations. The typical question is: given an input u(t)u(t) and initial conditions, what is the output y(t)y(t)? Before introducing Laplace transforms, this note solves the problem directly in the time domain. It builds on the input-output ODE of System ModelingA mathematical model (parameters, variables, relations) describes a system quantitatively; models are classified as static or dynamic, causal, linear, time-invariant, SISO or MIMO, and the course focuses on SISO continuous-time causal dynamic LTI systems described by a constant-coefficient input-output ODE.System Modeling → and prepares the study of poles and stability (see The Routh-Hurwitz CriterionThe Routh-Hurwitz criterion decides whether all roots of a characteristic polynomial lie in the open left half-plane, and counts the right-half-plane roots, by building a table (the Routh array) from the coefficients and counting sign changes in its first column.The Routh-Hurwitz Criterion →).

1. From a physical system to a differential equation

 physical system --> physical laws --> differential equation --> time-domain response

Two simple examples show where an ODE comes from.

1.1 Mechanical example: mass-spring-damper

A mass mm is connected to a wall through a spring kk and a damper cc, and is pushed by an applied force F(t)F(t). Output: displacement x(t)x(t). Input: force F(t)F(t).

Newton's law: ∑F=mx¨\sum F = m\ddot{x}. The spring and the damper oppose the motion, so

F−kx−cx˙=mx¨,F - kx - c\dot{x} = m\ddot{x},

hence

mx¨+cx˙+kx=F(t).\boxed{m\ddot{x} + c\dot{x} + kx = F(t).}

1.2 Electrical example: RC circuit

A voltage source vin(t)v_{in}(t) feeds a resistor RR in series with a capacitor CC; current i(t)i(t) flows in the loop. Output: capacitor voltage vC(t)v_C(t). Input: vin(t)v_{in}(t).

Kirchhoff's voltage law: vin=vR+vCv_{in} = v_R + v_C. Using vR=R iv_R = R\,i and i=C v˙Ci = C\,\dot{v}_C we obtain vin=RC v˙C+vCv_{in} = RC\,\dot{v}_C + v_C, therefore

RC v˙C+vC=vin(t).\boxed{RC\,\dot{v}_C + v_C = v_{in}(t).}

1.3 Different systems, same mathematical structure

mx¨+cx˙+kx⏟mechanical system=F(t),RC v˙C+vC⏟electrical system=vin(t).\underbrace{m\ddot{x} + c\dot{x} + kx}_{\text{mechanical system}} = F(t), \qquad \underbrace{RC\,\dot{v}_C + v_C}_{\text{electrical system}} = v_{in}(t).

Both belong to the same family

any(n)+an−1y(n−1)+⋯+a1y˙+a0y=bmu(m)+⋯+b0u.a_n y^{(n)} + a_{n-1} y^{(n-1)} + \dots + a_1 \dot{y} + a_0 y = b_m u^{(m)} + \dots + b_0 u.

Control-system viewpoint: once the model is written as an ODE, the same mathematical tools can be used independently of the physical domain.

2. The linear time-invariant differential equation

A general input-output model is

any(n)(t)+an−1y(n−1)(t)+⋯+a1y˙(t)+a0y(t)=bmu(m)(t)+⋯+b0u(t).a_n y^{(n)}(t) + a_{n-1} y^{(n-1)}(t) + \dots + a_1 \dot{y}(t) + a_0 y(t) = b_m u^{(m)}(t) + \dots + b_0 u(t).

  • u(t)u(t): input;
  • y(t)y(t): output;
  • y(0),y˙(0),…y(0), \dot{y}(0), \dots: initial conditions.

3. The key idea: split the solution

For a linear ODE the solution can be written as

y(t)=yh(t)+yp(t).\boxed{y(t) = y_h(t) + y_p(t).}

Homogeneous solution yhy_h Particular solution ypy_p
solution of the equation with zero input one solution caused by the input
natural behavior forced behavior

Later this becomes closely related to the zero-input and zero-state response.

4. First-order system

Consider

y˙(t)+a y(t)=b u(t),a>0.\dot{y}(t) + a\,y(t) = b\,u(t), \qquad a > 0.

For a constant input u(t)=Uu(t) = U we want to solve y˙(t)+a y(t)=bU\dot{y}(t) + a\,y(t) = bU.

Step 1: homogeneous solution

Set the input to zero: y˙+ay=0\dot{y} + ay = 0. Try yh(t)=Ceλty_h(t) = Ce^{\lambda t}. Then

λCeλt+aCeλt=0  ⇒  λ+a=0  ⇒  λ=−a,\lambda C e^{\lambda t} + a C e^{\lambda t} = 0 \;\Rightarrow\; \lambda + a = 0 \;\Rightarrow\; \lambda = -a,

so

yh(t)=Ce−at.\boxed{y_h(t) = C e^{-at}.}

Step 2: particular solution

For a constant input, try a constant: yp(t)=Ky_p(t) = K. Since y˙p=0\dot{y}_p = 0, we get aK=bUaK = bU, so

yp(t)=ba U.\boxed{y_p(t) = \frac{b}{a}\,U.}

The complete solution is y(t)=Ce−at+baUy(t) = C e^{-at} + \dfrac{b}{a}U.

Step 3: impose the initial condition

Let y(0)=y0y(0) = y_0. From y(t)=Ce−at+baUy(t) = Ce^{-at} + \frac{b}{a}U we get y0=C+baUy_0 = C + \frac{b}{a}U, thus C=y0−baUC = y_0 - \frac{b}{a}U and

y(t)=baU+(y0−baU)e−at.\boxed{y(t) = \frac{b}{a}U + \left(y_0 - \frac{b}{a}U\right) e^{-at}.}

Interpretation: transient and steady state

y(t)=baU⏟steady state+(y0−baU)e−at⏟transient.y(t) = \underbrace{\frac{b}{a}U}_{\text{steady state}} + \underbrace{\left(y_0 - \frac{b}{a}U\right)e^{-at}}_{\text{transient}}.

  • e−ate^{-at} is the natural mode;
  • if a>0a > 0 the transient decays;
  • the time constant is τ=1a\tau = \dfrac{1}{a}.

Example 1: first-order response

Solve y˙+2y=4\dot{y} + 2y = 4, y(0)=1y(0) = 1.

  • Homogeneous: yh=Ce−2ty_h = Ce^{-2t}.
  • Particular: yp=Ky_p = K, 2K=4⇒K=22K = 4 \Rightarrow K = 2.
  • Complete: y(t)=2+Ce−2ty(t) = 2 + Ce^{-2t}.
  • Initial condition: 1=2+C⇒C=−11 = 2 + C \Rightarrow C = -1.

y(t)=2−e−2t.\boxed{y(t) = 2 - e^{-2t}.}

(Here a=2a = 2, so τ=1/2\tau = 1/2 and the steady state is 22.)

Exercise (with the solution of the slides)

Solve y˙+3y=6\dot{y} + 3y = 6, y(0)=0y(0) = 0, then identify the homogeneous solution, particular solution, transient term, steady-state value and time constant.

  • Homogeneous: yh=Ce−3ty_h = Ce^{-3t}.
  • Particular: yp=Ky_p = K, 3K=6⇒K=23K = 6 \Rightarrow K = 2.
  • Complete: y(t)=2+Ce−3ty(t) = 2 + Ce^{-3t}; from y(0)=0y(0) = 0: 0=2+C⇒C=−20 = 2 + C \Rightarrow C = -2.

y(t)=2−2e−3t,τ=13.\boxed{y(t) = 2 - 2e^{-3t}}, \qquad \boxed{\tau = \tfrac{1}{3}}.

Identification: transient term −2e−3t-2e^{-3t}; steady-state value 22.

5. Second-order homogeneous ODE

Consider

y¨+a1y˙+a0y=0.\ddot{y} + a_1\dot{y} + a_0 y = 0.

Try y(t)=eλty(t) = e^{\lambda t}. Then λ2eλt+a1λeλt+a0eλt=0\lambda^2 e^{\lambda t} + a_1\lambda e^{\lambda t} + a_0 e^{\lambda t} = 0. Since eλt≠0e^{\lambda t} \neq 0,

λ2+a1λ+a0=0\boxed{\lambda^2 + a_1\lambda + a_0 = 0}

This is the characteristic equation. Its roots λi\lambda_i produce the natural modes eλite^{\lambda_i t} of the system:

 characteristic equation --> roots lambda_i --> natural modes e^(lambda_i t)

Later, the same roots will appear as the poles of the transfer function.

Case 1: two distinct real roots

If λ1≠λ2\lambda_1 \neq \lambda_2, both real, then

yh(t)=C1eλ1t+C2eλ2t.y_h(t) = C_1 e^{\lambda_1 t} + C_2 e^{\lambda_2 t}.

Example: λ1=−1\lambda_1 = -1, λ2=−3⇒yh(t)=C1e−t+C2e−3t\lambda_2 = -3 \Rightarrow y_h(t) = C_1 e^{-t} + C_2 e^{-3t}. Both modes decay.

Case 2: repeated real root

If λ1=λ2=λ\lambda_1 = \lambda_2 = \lambda, then

yh(t)=(C1+C2t) eλt.y_h(t) = (C_1 + C_2 t)\,e^{\lambda t}.

Example: λ=−2⇒yh(t)=(C1+C2t)e−2t\lambda = -2 \Rightarrow y_h(t) = (C_1 + C_2 t)e^{-2t}. The term te−2tte^{-2t} still decays as t→∞t \to \infty.

Case 3: complex conjugate roots

If λ1,2=σ±jω\lambda_{1,2} = \sigma \pm j\omega, then

yh(t)=eσt[C1cos⁡(ωt)+C2sin⁡(ωt)].y_h(t) = e^{\sigma t}\left[C_1\cos(\omega t) + C_2\sin(\omega t)\right].

  • σ\sigma controls growth or decay;
  • ω\omega controls the oscillation frequency;
  • if σ<0\sigma < 0 the oscillations are damped.

Stability intuition from natural modes

For a homogeneous solution made of modes eλite^{\lambda_i t}:

Root location Mode behavior Intuition
Re(λi)<0\text{Re}(\lambda_i) < 0 decays stable mode
Re(λi)=0\text{Re}(\lambda_i) = 0 does not decay marginal case
Re(λi)>0\text{Re}(\lambda_i) > 0 grows unstable mode

This is the first appearance of a central control idea: stability depends on the roots of the characteristic equation.

6. Particular solutions: a minimal recipe

For simple inputs, try a particular solution with the same shape as the input:

Input shape Try for yp(t)y_p(t)
constant KK AA
linear KtKt At+BAt + B
exponential KeαtKe^{\alpha t} AeαtAe^{\alpha t}
sinusoid Ksin⁡(ωt)K\sin(\omega t) Asin⁡(ωt)+Bcos⁡(ωt)A\sin(\omega t) + B\cos(\omega t)

This is enough for the basic examples before Laplace transforms. The constants A,BA, B are found by substituting ypy_p in the ODE.

7. Example 2: complete second-order solution

Solve y¨+3y˙+2y=2\ddot{y} + 3\dot{y} + 2y = 2, y(0)=0y(0) = 0, y˙(0)=0\dot{y}(0) = 0.

Homogeneous part. Characteristic equation λ2+3λ+2=0\lambda^2 + 3\lambda + 2 = 0, i.e. (λ+1)(λ+2)=0(\lambda + 1)(\lambda + 2) = 0, so λ1=−1\lambda_1 = -1, λ2=−2\lambda_2 = -2 and

yh(t)=C1e−t+C2e−2t.y_h(t) = C_1 e^{-t} + C_2 e^{-2t}.

Particular part. The input is constant, so try yp=Ky_p = K. Since y˙p=0\dot{y}_p = 0 and y¨p=0\ddot{y}_p = 0, substituting gives 2K=2⇒K=12K = 2 \Rightarrow K = 1. Therefore

y(t)=1+C1e−t+C2e−2t.y(t) = 1 + C_1 e^{-t} + C_2 e^{-2t}.

Initial conditions. From y(0)=0y(0) = 0: 0=1+C1+C20 = 1 + C_1 + C_2. The derivative is y˙(t)=−C1e−t−2C2e−2t\dot{y}(t) = -C_1 e^{-t} - 2C_2 e^{-2t}, and from y˙(0)=0\dot{y}(0) = 0: 0=−C1−2C20 = -C_1 - 2C_2. Solving the two equations (add them: 0=1−C2⇒C2=10 = 1 - C_2 \Rightarrow C_2 = 1, then C1=−2C_1 = -2):

y(t)=1−2e−t+e−2t.\boxed{y(t) = 1 - 2e^{-t} + e^{-2t}.}

What to read in the solution:

y(t)=1⏟steady state+(−2e−t+e−2t)⏟transient.y(t) = \underbrace{1}_{\text{steady state}} + \underbrace{\left(-2e^{-t} + e^{-2t}\right)}_{\text{transient}}.

  • the final value is 11;
  • the terms −2e−t-2e^{-t} and e−2te^{-2t} disappear as t→∞t \to \infty;
  • these terms are the natural modes;
  • the roots −1-1 and −2-2 (both with negative real part) tell us that both modes decay, hence the system settles at the steady state.

8. From ODEs to Laplace transforms

The time-domain solution is possible, but it can become algebraically heavy. Laplace transforms will let us move from differential equations to algebraic equations, which is why they are so useful in control systems.

Versione ripasso

Models as ODEs: mass-spring-damper mx¨+cx˙+kx=F(t)m\ddot{x} + c\dot{x} + kx = F(t); RC circuit RCv˙C+vC=vin(t)RC\dot{v}_C + v_C = v_{in}(t). Same family any(n)+⋯+a0y=bmu(m)+⋯+b0ua_n y^{(n)} + \dots + a_0 y = b_m u^{(m)} + \dots + b_0 u, so the same tools apply to any physical domain.

Splitting: y(t)=yh(t)+yp(t)y(t) = y_h(t) + y_p(t).

  • yhy_h: zero input, natural behavior (from the characteristic equation);
  • ypy_p: caused by the input, forced behavior.

Recipe:

  1. write the characteristic equation (try eλte^{\lambda t}) and find the roots;
  2. build yhy_h with free constants;
  3. find ypy_p with the same shape as the input;
  4. add them and fix the constants with the initial conditions (y(0),y˙(0),…y(0), \dot{y}(0), \dots; differentiate yy when needed).

First order y˙+ay=bU\dot{y} + ay = bU, y(0)=y0y(0) = y_0:

y(t)=baU+(y0−baU)e−at,τ=1a.y(t) = \frac{b}{a}U + \left(y_0 - \frac{b}{a}U\right)e^{-at}, \qquad \tau = \frac{1}{a}.

Steady state baU\frac{b}{a}U, transient (y0−baU)e−at\left(y_0 - \frac{b}{a}U\right)e^{-at}.

Second order y¨+a1y˙+a0y=0\ddot{y} + a_1\dot{y} + a_0 y = 0: characteristic equation λ2+a1λ+a0=0\lambda^2 + a_1\lambda + a_0 = 0.

Roots yh(t)y_h(t)
distinct real λ1≠λ2\lambda_1 \ne \lambda_2 C1eλ1t+C2eλ2tC_1 e^{\lambda_1 t} + C_2 e^{\lambda_2 t}
repeated real λ\lambda (C1+C2t)eλt(C_1 + C_2 t)e^{\lambda t}
complex σ±jω\sigma \pm j\omega eσt[C1cos⁡(ωt)+C2sin⁡(ωt)]e^{\sigma t}\left[C_1\cos(\omega t) + C_2\sin(\omega t)\right]

Stability from the roots: Re(λi)<0\text{Re}(\lambda_i) < 0 decays (stable), =0= 0 does not decay (marginal), >0> 0 grows (unstable). Stability depends on the roots of the characteristic equation.

Particular solution guesses: constant K→AK \to A; Kt→At+BKt \to At + B; Keαt→AeαtKe^{\alpha t} \to Ae^{\alpha t}; Ksin⁡(ωt)→Asin⁡(ωt)+Bcos⁡(ωt)K\sin(\omega t) \to A\sin(\omega t) + B\cos(\omega t).

Worked results: y˙+2y=4\dot{y} + 2y = 4, y(0)=1y(0) = 1 gives y=2−e−2ty = 2 - e^{-2t}. y¨+3y˙+2y=2\ddot{y} + 3\dot{y} + 2y = 2, y(0)=y˙(0)=0y(0) = \dot{y}(0) = 0 gives y=1−2e−t+e−2ty = 1 - 2e^{-t} + e^{-2t}. y˙+3y=6\dot{y} + 3y = 6, y(0)=0y(0) = 0 gives y=2−2e−3ty = 2 - 2e^{-3t}, τ=1/3\tau = 1/3.

Typical mistakes: imposing the initial conditions on yhy_h alone instead of on the complete yh+ypy_h + y_p; forgetting the derivative condition y˙(0)\dot{y}(0) for a second-order ODE; forgetting the factor tt for a repeated root; reading the time constant as aa instead of 1/a1/a.

Next: Laplace transforms turn the ODE into an algebraic equation.

Teoria collegata