Experiment 8

Part 1: Laplace Transform:

Objective

The purpose of this lab to gain familiarity with Laplace transforms, including the Laplace transforms of step functions and related functions.

Introduction:

Laplace transform is used for solving differential and integral equations. In physics and engineering, it is used for analysis of linear time-invariant systems such as electrical circuits, harmonic oscillators, optical devices, and mechanical systems. In this analysis, the Laplace transform is often interpreted as a transformation from the time-domain, in which inputs and outputs are functions of time, to the frequency-domain, where the same inputs and outputs are functions of complex angular frequency, in radians per unit time.

Denoted , it is a linear operator on a function f(t) (original) that transforms it to a function F(s) (image) with a complex argument s.

The Laplace transform has the useful property that many relationships and operations over the originals f(t) correspond to simpler relationships and operations over the images F(s).

Formal Definition

The Laplace transform of a function f(t), is the function F(s), defined by:

The parameter s is a complex number:

with real numbers σ and ω.

Note: the Fourier Transform is a special case of the Laplace Transform when σ= 0

The inverse Laplace transform x(t) is given by the following complex integral:

x(t)= 1/(2 pi *j) ∫ X(s) est ds

Laplace Transform of elementary functions:

Exponential function:

Unit step function:

Sinusoidal functions:

Transfer functions:

A transfer function (also known as the network function) is a mathematical representation, of the relation between the input and output of a (linear time-invariant) system

It is obtained using the Laplace transform of the output divided by the Laplace transform of the input or simply its the Laplace transform of the impulse response of the system.

Transfer functions are used because they simplify operations ,Suppose we wished to find the output to a filter whose input is

and whose transfer function is

we could take the symbolic Laplace transform ,multiply it by 1/(s+3), and then take the inverse Laplace transform as follows:

> syms x t s;

> x = exp(-2*t);

> X = laplace(x);

> H = 1/(s+3);

> Y = X*H;

> y = ilaplace(Y);

Specifying Transfer Functions in MATLAB

In MATLAB, transfer functions are specified by the numerator and denominator coefficients. Thus, the transfer function

can be specified in MATLAB as:

> h = tf([2 3], [1 5 6]);

If we specify an input to this transfer function,

> t = 0:0.01:1;

> x = exp(-t);

we can then find the response using

> [y, t] = lsim (h, x, t);

Method of partial fraction expansion:

Consider a linear time-invariant system with transfer function

The impulse response is simply the inverse Laplace transform of this transfer function:

To evaluate this inverse transform, we begin by expanding H(s) using the method of partial fraction expansion:

The unknown constants P and R are the residues located at the corresponding poles of the transfer function.. By the residue theorem, the inverse Laplace transform depends only upon the poles and their residues. To find the residue P, we multiply both sides of the equation by (s + α) to get

Then by letting s = − α, the contribution from R vanishes and all that is left is

Similarly, the residue R is given by

Note that

and so the substitution of R and P into the expanded expression for H(s) gives

Finally, using the linearity property and the known transform for exponential decay we can take the inverse Laplace transform of H(s) to obtain:

which is the impulse response of the system. And this is done easily in MATLAB using the command residue.

¨  Use the residue command to find the inverse Laplace transform of the following functions:

1.  X1(s)= (2s2+5)/(s2+3 s+2).

Num=[2 0 5];

Den=[1 3 2];

[r, p, k ]=residue(Num,Den)

Exercises:

¨  Find the Laplace transform of these functions:

1.  x(t)= u(t).

2.  x(t)= t u(t).

3.  x(t)= sin t , -π < t< π.

4.  x(t)=tcos(ωοt)u(t).

¨  Find the inverse Laplace transform of these functions:

1.  X(s)=(s+1) / s(s+2)2(s2+4s+5)

2.  X(s)=(2s +5)e-2s/(s2+5s+6)

¨  Use the residue command to find the inverse Laplace transform of the following functions:

1. X (s)= (2s2+7s+4)/(s+1)(s+2)2

2.  X (s)= (8 s2+21s+19)/(s+2)( s2 +s+7).

¨  Find the response to the transfer function

to the input

using MATLAB (Laplace and ilaplace commands)

¨  Find the response to

to the input

using lsim, Plot the results. Compare these results to the results of the previous section:

Part Two: Solving differential equations using Matlab:

1.  Consider an LTIC system specified by the differential equation

D2+4D+3yt=(3D+5)xt

Using initial conditions y0 0=3 and y0 0=-7 determine the zero input component

y0=dsolve('D2y+4*Dy+3*y=0','y(0)=3','Dy(0)=-7','t');

disp(['y0=',char(y0)]);

y0=exp(-t)+2*exp(-3*t)

2.  Determine the impulse response h(t) for an LTIC system specified by the differential equation

D2+3D+2yt=Dxt

This is a second order system with bo=0. First we find the zero –input component for initial conditions y(0)=0 and y(0)=1. Since P (D) =D the zero-input response is differentiated and the impulse response immediately follows.

yn=dsolve('D2y+3*Dy+2*y=0','y(0)=0','Dy(0)=1','t');

Dyn=diff(yn);

disp(['h(t)=(',char(Dyn),')u(t)']);

yn =

exp(-t)-exp(-2*t)

Dyn =

-exp(-t)+2*exp(-2*t)

h(t)=(-exp(-t)+2*exp(-2*t))u(t)

DSOLVE :Symbolic solution of ordinary differential equations.

DSOLVE('eqn1','eqn2', ...) accepts symbolic equations representing

ordinary differential equations and initial conditions. Several

equations or initial conditions may be grouped together, separated

by commas, in a single input argument.

By default, the independent variable is 't'. The independent variable

may be changed from 't' to some other symbolic variable by including

that variable as the last input argument.

The letter 'D' denotes differentiation with respect to the independent

variable, i.e. usually d/dt. A "D" followed by a digit denotes

repeated differentiation; e.g., D2 is d^2/dt^2.

Part 3: Solving difference equations recursively:

1.  Solve iteratively

yn+2-yn+1+.24yn=xn+2-2x[n+1]
with initial conditions y[-1]=2 y[-2]=1 and a causal input x[n]=n starting at n=0.

n=(-2:10)';

y=[1;2;zeros(length(n)-2,1)];

x=[0;0;n(3:end)];

for k=1:length(n)-2

y(k+2)=y(k+1)-.24*y(k)+x(k+2)-2*x(k+1);

end

stem(n,y)

xlabel('n');

ylabel('y[n]');

disp('n y');

disp([num2str([n,y])]);

n y

-2 1

-1 2

0 1.76

1 2.28

2 1.8576

3 0.3104

4 -2.13542

5 -5.20992

6 -8.69742

7 -12.447

8 -16.3597

9 -20.3724

10 -24.4461