### Process Control And Instrumentation Homework For Chemical Engineering

CBE 430 Week 03

Laplace Transforms Mathematical models of real processes often result in systems of linear ODEs.

The Laplace transform can reduce the time required to find a solution, by converting ODEs to equations.

Let’s review Laplace transforms!

ℒ = න 0

− =

ℒ−1 =

Laplace Domain

() ()

Time Domain

Slide 03.01

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

CBE 430 Week 03

Laplace Transforms Constant function:

Unit step function:

Exponential:

Rectangular Pulse:

ℒ = න 0

− = −

0

=

ℒ = 1

Notice, the Laplace transform doesn’t care what happens at < 0! So the unit step at = 0 is the same as the constant with = 1.

ℒ () = න 0

−− = න 0

−(+) = − − +

+ 0

= 1

+

= ቐ 0 < 0 ℎ 0 ≤ < 0 ≥

ℒ () = න 0

ℎ− = − ℎ

− ቚ

0

= ℎ

1 − −

=

= = ቊ 0 < 0 1 ≥ 0

= −

Slide 03.02

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

CBE 430 Week 03

How About a Time Delay (Lag). In chemical and biological processes, one function is often related to another by a time delay (lag). The simplest example is:

= − − ensures that = 0 before the lag time. This can happen when and measure the same thing (e.g. a temperature or concentration) at different points in a , for example.

What is the Laplace transform of ()?

Slide 03.03

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

CBE 430 Week 03

How About a Time Delay (Lag).

= − −

ℒ = ℒ − −

= න 0

− − −

= න 0

− 0 − + න

− −

= න

− − − − −

= −න 0

∗ − ∗ ∗

ℒ[ ] = −

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.04

CBE 430 Week 03

Now you try one:

Use the property:

and the Euler formula for the cosine:

To find

ℒ + = ℒ + ℒ

= 1

2

1

− +

1

+

cos = + −

2 ; ≡ −1

ℒ[cos ] = 1

2 ℒ +

1

2 ℒ −

= 1

2

+ + −

2 +2 =

2 +2

ℒ[cos ]

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.05

CBE 430 Week 03

= = − +

= = − 1

+ − +

ℒ = − − +

+ =0

=∞

+න 0

∞ − +

+

= 0 − 0 − − +

+ 2 =0

=∞

= 1

+ 2

ℒ −

Integration by parts! න 0

= −න 0

= න 0

−− = න 0

− +

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.06

CBE 430 Week 03

One more important example…

The impulse (with area ): =

ℒ () = lim →0

1 − −

Where is the function. has an area of 1, a height of infinity, and a width of 0. This can be modeled as a pulse of ℎ = 1/ as → 0. Using the result for the pulse…

Apply l’Hôpital’s rule (differentiate by ):

ℒ = lim →0

1 − −

= lim

→0

=

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.07

CBE 430 Week 03

Why is this useful?

Finding Laplace transforms is fun and easy, but that’s not why we use them. In fact, we usually don’t bother finding them at all… we in a table (like Table 3.1 on pp. 40-41 of Seborg).

Laplace transforms are useful because they help us to find solutions to differential equations.

…here’s how… →

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.08

CBE 430 Week 03

Time-Derivatives What is the Laplace transform of the time-derivative?

How about the second time derivative?

For the ℎ derivative:

= න

0

− = − ቚ

0

∞ −න

0

= − 0 + න 0

= − 0 + ℒ

ℒ 2

2 = ℒ

; where =

= − 0 + − 0

= − 0 +

= 2 − ቤ

=0

− 0

This is awesome! Now we can use Laplace transforms to replace first derivatives!

= − ෍

=0

−1

อ −1−

−1− =0

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.09

CBE 430 Week 03

A First-Order ODE Example

5

+ 4 = 2; 0 = 1

5ℒ

+ 4ℒ = ℒ 2

5 − 0 + 4 = 2

5 − 5 1 + 4 = 2

5 + 4 = 2

+ 5

= 2

5 + 4 +

5

5 + 4

ℒ[ ]

Solve for

Now invert using Table 3.1. Notice that entries 5 and 6, and 9 and 10 are equivalent alternative representations.

= 2

5

1

+ 0 + 4 5

+ 1

+ 4 5

= −0.5 −0.8 − 1 + −0.8

= 0.5 1 − −0.8

Transform equation

ℒ−1[ ]

Notice the gets used here!

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.10

CBE 430 Week 03

A Higher-Order ODE Example

3

3 + 6

2

2 + 11

+ 6 = 1;

= 1

(3 + 62 + 11 + 6)

อ 2

2 0

= 0; ቤ

0

= 0; 0 = 0

How many IC’s do we need?

ℒ 3

3 + 6ℒ

2

2 + 11ℒ

+ 6ℒ = ℒ 1

3 + 62 + 11 + 6 = 1

Find the (4) roots of the (4th-order) polynomial in the denominator, so it can be factored! Roots are = 0, -1, -2, and -3. =

1

( + 1)( + 2)( + 3)

Perform . =

1 +

2 + 1

+ 3

+ 2 +

4 + 3

1 = 1

6 ; 2 = −

1

2 ; 3 =

1

2 ; 4 = −

1

6 Perform Heaviside expansion.

= 1

6 − 1

2 − +

1

2 −2 −

1

6 −3

When did we use the IC’s?!?!

ℒ[ ]

ℒ−1[ ]

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.11

CBE 430 Week 03

What was that Heaviside thing?

=

=

1

( + 1)( + 2)( + 3) = 1 +

2 + 1

+ 3

+ 2 +

4 + 3

Find the coefficients using .

1. Multiply the whole equations by one of the terms in the denominator (for example, the second one).

2. Choose so that all the remaining are . In this case, we set = −1. Compute 2.

+ 1

+ 1 + 2 + 3 = 2 + + 1

1 +

3 + 2

+ 4

+ 3

1

−1 −1 + 2 [ −1 + 3] = 2 =

1

−1 × 1 × 2 = −

1

2

In general… = ቤ +

=−

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.12

CBE 430 Week 03

An example with repeated roots 2

2 + 4

+ 4 = 1; อ

2

2 0

= 0; ቤ

0

= 1; 0 = 0

2 − 0 − ቤ

0

+ 4 − 0 + 4 = 1

2 − 1 + 4 + 4 = 1

2 + 4 + 4 = 1

+ 1 =

+ 1

= + 1

2 + 4 + 4

Use the Heaviside method to find 1 and 3

= + 1

2 + 4 + 4 = 1 +

2 + 2

+ 3

+ 2 2

Can’t use the Heaviside method for 2 because multiplication by + 2 , and setting doesn’t eliminate the 3 term; it blows up.

1 = 0 + 1

02 + 4 0 + 4 = 1

4 ; 3 =

−2 + 1

−2 = 1

2

Then just choose another to find 2; choose = −1

2 = + 1

(2 + 4 + 4) −

1

4 −

1

2 + 2 2 ; 2 =

1

4 − 1

2 = −

1

4

The denominator is a 3rd-order polynomial, so there must be 3 constants.

IC’s used here!

ℒ[ ]

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.13

CBE 430 Week 03

Or, you can take the derivative =

+ 1

2 + 4 + 4 = 1 +

2 + 2

+ 3

+ 2 2

For multiple repeated roots, or roots repeated several times, the derivative method helps ensure you have to solve for all of the unknown . The general formula that you can use in this case is:

= 1

− ! lim →−

− +

3 = ቤ + 2 2

=−2

; 2 = อ

+ 2 2

s=−2

; 1 = ቤ

=0

3 = 1

2 ; 2 = ቤ

1 +

1

s=−2

= − 1

−2 2 = −

1

4 ; 1 =

1

4

= 1

( + ) +

2 + 2

+⋯

+ +⋯ =෍

+ +⋯

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.14

CBE 430 Week 03

Heaviside expansion will

give complex 1,2 = − 1

3

= 1

2 + + 2.5 =

1 + 1

+ 2

+ 2

=

; = 2 + + ; 2 < 4 →

1, 2 = −1 ± 12 − 4 1 2.5

2 1 = −

1

2 ±

−9

2 = −

1

2 ± 3

2

Find 1 and 2 from the roots of

Instead, lets put () in the form of one of the entries in the Table 3.1 on p. 42. – How about number 17?

=

+ 2 + 2 =

1

2 + + 2.5

This term has to give both

2 and . So = 1

2 .

Now the denominator is:

= + 1

2

2

+ 2 = 2 + s + 1

4 + 2 = 2 + s + 2.5

2 = 2.25; = 1.5

= 1; = 2

3

= 2

3

1.5

+ 1 2

2

+ 1.52

= 2

3 −0.5sin(1.5)

Find :

Complex roots will always give in the time domain.

Find : ℒ−1[ ]

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.15

CBE 430 Week 03

Some Properties of Laplace Transforms 1. The transform and reverse transform are both linear operations, allowing you to use superposition:

2. The theorem:

3. The initial value theorem:

4. The theorem:

5. Convolution:

6. When has positive real denominator roots ( < 0), () will grow exponentially.

7. When () has complex denominator roots ( 2< 0), will oscillate .

8. When () has an exponential in , () has a .

ℒ + = ℒ + ℒ

lim →∞

() = lim →0

[ ]

=

= ℒ−1 = න 0

ℎ − = න 0

− ℎ

lim →0

() = lim →∞

[ ]

ℒ − 0 − 0 = −0()

We’ll make use of these a lot.

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.16

CBE 430 Week 03

Let’s do Example 3.6

Check out how the CSTR works. (Are there recirculation zones, dead zones, or other non-ideal mixing?)

Do an impulse test with a tracer, compare the concentration coming out, 2(), to the predicted concentration assuming .

Compare the theoretical solutions of the responses to (perfect) impulse, and (physically realizable) rectangular pulse test.

Find: a) The magnitude of an impulse that would model

the total amount of material added with the pulse shown at the right.

b) The impulse and pulse responses of the reactant concentration leaving the reactor, .

= 4 3

= 2 3 −1

= 1 −3

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.17

CBE 430 Week 03

Example 3.6(a)

Find: a) The magnitude of an impulse that would

model the total amount of material added with the pulse shown at the right.

; =

Define the = − ഥ and = − ҧ Where ഥ and ҧ are the respective values.

, = ൝ 6 − 1 −3 0 ≤ < 0.25

0 −3 < 0; 0.25 ≤

= 1.25 −3

∴ , = 1.25 ()

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.18

CBE 430 Week 03

Example 3.6(b)

Find: b) The impulse and pulse responses of the reactant concentration

leaving the reactor, . (Let’s find , instead.)

= −

Write a species mole balance on the tracer:

− ҧ

= − ഥ − − ҧ

Therefore, at steady state: ഥ = ҧ

Convert this mole balance to a differential equation for the .

=

− =

1

0 = 0

Now replace the inlet concentration (perturbation) with , and ,.

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.19

ҧ

= ഥ − ҧ = 0

CBE 430 Week 03

Example 3.6(b) continued

Impulse:

= 1

( − )

= 1

, −

= 1

− 0 = 1

= 1

+ 1 =

− Τ

Pulse:

= 1

, − − 0 =

5

1 − −0.25 −

1

= 5 1

+ 1 − −0.25

1

+ 1

= 5 1 − − Τ − 5 1 − − −0.25 / ( − 0.25)

This is a time lag!

Transform this term, then change to − 0.25 and multiply by the step function. = ቐ

5 1 − − Τ ; < 0.25

5 − Τ−0.25 − − Τ ; ≥ 0.25

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.20

CBE 430 Week 03

Example 3.6(b) continued

= 1

( − )

=

1 − Τ

= ቐ 5 1 − − Τ ; < 0.25

5 − Τ−0.25 − − Τ ; ≥ 0.25

Impulse:

Pulse:

0.6

0.5

0.4

0.3

0.2

0.1

0.0

1086420

Time, t (min)

impulse pulse

= 1.25

=

= 2

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.21

CBE 430 Week 03

Laplace transforms using MATLAB

MATLAB can really help with Laplace transforms!

Use symbolic math toolbox and commands

laplace

ilaplace

Consider from slide 04.06 …

>>syms t f(t)

>>f = t*exp(-t)

f =

t*exp(-t)

>> F = laplace(f)

F =

1/(s + 1)^2

>> f = ilaplace(F)

f =

t*exp(-t)

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.22

CBE 430 Week 03

Laplace transforms using MATLAB

How about for ODEs? Consider from slide 03.10:

>>syms t y(t)

>>dydt = diff(y,t)

dydt(t) =

diff(y(t), t)

>>laplace(5*dydt + 4*y==2)

ans =

5*s*laplace(y(t), t, s) – 5*y(0) + 4*laplace(y(t), t, s) == 2/s

Interpret this:

5

+ 4 = 2; 0 = 1

Define t and y(t) as symbolic variables. Make sure to tell MATLAB that y is a function of t.

Next, create a symbolic variable for the . (You can also define higher order derivatives with diff.)

Take the Laplace transform of the defining equation! Remember to use ==.

5 − 5 0 + 4 = 2

Compare to slide 03.10

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.23

CBE 430 Week 03

Laplace transforms using MATLAB

Take care defining constants and variables!

>>syms t y1(t) a

>>Y1 = laplace(y1)

Y1 =

laplace(y(t), t, s)

>>A = laplace(a)

A = 1/s^2

Matlab didn’t know what you wanted the independent variable to be, so it a. This is the Laplace transform of .

To take the Laplace transform of a constant, a:

>>syms a, t, s

>>laplace(a, t, s)

ans =

a/s

Expected behavior. What will happen for a?

??? What is this ?!!

y1 is a function, a is just another variable.

This tells MATLAB everything it needs to know: • Take the Laplace transform of a; • Use t as the independent variable; • Use s is the Laplace-domain independent variable. (Otherwise, MATLAB has to guess what you want!)

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.24

CBE 430 Week 03

Summary 1. Laplace transforms convert time-domain functions to equivalent functions in a Laplace

domain. The independent variable is .

2. This is useful for solving differential equations, because derivatives are converted to algebraic equations when converting from the time domain to the Laplace domain.

3. Conversion to the Laplace domain decomposes a function helps to find characteristic , frequencies, and .

4. Some features of the time-domain solution can be easily identified in the Laplace domain (e.g. an exponential decay, a sinusoidal oscillation, a time lag). We’ll get more practice at identifying these. →With experience you can tell a lot about time-domain dynamics without inverting the Laplace-domain equations!

5. You can use MATLAB laplace and ilaplace

Topics • Laplace

transforms • Solving

ODEs • Properties

of ℒ[ ] • Example

3.6 • MATLAB

Slide 03.25

Price (USD)
\$