16
SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS Example: Mathematical model of a mechanical system is defined as a system of differential equations as follows: f 2 x 5 x 12 x 0 f 5 . 1 x 15 x 20 x 2 1 2 2 1 1 where f is input, x 1 are x 2 outputs. At t=0 x 1 =2 and x 2 =-1. a) Find the eigenvalues of the system. b) If f is a step input having magnitude of 3, find x 1 (t). c) If f is a step input having magnitude of 3, find x 2 (t). d) Find the response of x 1 due to the initial conditions. e) Find the response of x 2 due to the initial conditions. f) How do you obtain [sI-A] -1 with MATLAB?

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Embed Size (px)

DESCRIPTION

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS. Example:. Mathematical model of a mechanical system is defined as a system of differential equations as follows:. where f is input, x 1 are x 2 outputs. At t=0 x 1 =2 and x 2 =-1. Find the eigenvalues of the system. - PowerPoint PPT Presentation

Citation preview

Page 1: SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Example:

Mathematical model of a mechanical system is defined as a system of differential equations as follows:

f2x5x12x0f5.1x15x20x

212

211

where f is input, x1 are x2 outputs.

At t=0 x1=2 and x2=-1.

a) Find the eigenvalues of the system.

b) If f is a step input having magnitude of 3, find x1(t).

c) If f is a step input having magnitude of 3, find x2(t).

d) Find the response of x1 due to the initial conditions.

e) Find the response of x2 due to the initial conditions.

f) How do you obtain [sI-A]-1 with MATLAB?

Page 2: SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Let us obtain the State Variables Form so as to 1st order derivative terms are left-hand side and non-derivative terms are on the right-hand side.

f2x5x12xf5.1x15x20x

212

211

5s121520s

5121520

s00s

AsI

f25.1

xx

5121520

xx

2

1

2

1

State Variables Form

A B

280s15s)15(*)12()5s(*)20s(AsIdet 2

D(s)

20s12155s

280s15s1

]AsI[ 21

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Page 3: SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

a) Eigenvalues are roots of the polynomial D(s) or eigenvalues of the matrix A.

8371.10s8371.25s

1*2)280(*1*41515

s

0280s15s)s(D

2

1

2

2,1

2

or

b) x1(t) due to the forcing

)s(F25.1

AsI)0(x)0(x

AsI)s(X)s(X 1

2

11

G2

1

General Solution Solution due to the initial conditions

Homogeneous Solution

Solution due to the input Particular Solution

Initial Conditions

s

.

s

s

ss)s(X

)s(X

P

3

2

51

2012

155

28015

12

2

1

sss

.s.

s]*.)*s[(

ss)s(X

P 28015

567543215515

28015

12321

clc;clear;num=[4.5 67.5];den=[1 15 -280 0];[r,p,k]=residue(num,den)

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Page 4: SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

241102925005150

0

24110

837110

29250

837125

05150

8371108371251

1

.e.e.)t(x

s

.

.s

.

.s

.)s(X

t.t.P

P

System is instable because of the positive root. 0 0.5 1 1.5 2-1

0

1

2

3

4

5

6

7

8x 10

8

t(s)

x1(t

)

c) x2(t) due to input

s280s15s174s6

s3

]2*)20s(5.1*15[280s15s

1)s(X 2322Ö

clc;clear;num=[6 174];den=[1 15 -280 0];[r,p,k]=residue(num,den)

6214060140020

0

62140

837110

60140

837125

020

8371108371252

2

.e.e.)t(x

s

.

.s

.

.s

.)s(X

t.t.P

P

0 0.5 1 1.5 20

2

4

6

8

10

12

14

16x 10

8

t(s)

x2(t

)

Laplace transform of x2p

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Page 5: SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

d) x1 due to the initial conditions.

12

20s12155s

280s15s1

)s(X)s(X

2h2

1

280s15s25s2

280s15s)1(*152*)5s(

)s(X 22h1

clc;clear;num=[2 -25];den=[1 15 -280];[r,p,k]=residue(num,den)

t8371.10t8371.25h1 e0907.0e0907.2)t(x

e) x2 due to the initial conditions

280s15s4s

280s15s)1(*)20s(2*12

)s(X 222h

clc;clear;num=[-1 4];den=[1 15 -280];[r,p,k]= residue(num,den)

t8371.10t8371.25h2 e1864.0e8136.0)t(x

f) [sI-A]-1 with Matlab.clc;clear;syms s;i1=eye(2)A=[-20 15;12 5];a1=inv(s*i1-A)pretty(a1)

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Page 6: SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Example:

Mathematical model of a system is given below. Where V(t) is input, q1(t) and q2(t) are outputs.

• Write the equations in the form of state variables.

• Write Matlab code to obtain eigenvalues of the system.

• Write Matlab code to obtain matrix [sI-A]-1.

• Results of (b) and (c) which are obtained by computer are as follows:

s6s4s15s156s4s6s415

6s615s4

)15s6s4(s1

]AsI[2

2

2

21 0s,i7854.175.0s 32,1

At t=04.0)0(q3)0(q

5)0(q

2

2

1

and V(t) is a step input having magnitude of 2.

2qFind the Laplace transform of due to the initial conditions.

e) Find the Laplace transform of q1 due to the input.

2

t (s)

V2(t)

121 q2V)qq(3

0)qq(3q8.0 212

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Page 7: SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

121 q2V)qq(3 0)qq(3q8.0 212

a) State variables are q1, q2 and .uq2

System of differential equations is arranged so as to 1st order derivative terms are left-hand side and non-derivative terms are on the right-hand side.

212

2

211

q75.3q75.3quuq

V5.0q5.1q5.1q

b) Matlab code which gives the eigenvalues of the system.

A=[-1.5 1.5 0;0 0 1;3.75 -3.75 0]; eig(A)

c) Matlab code which produces [sI-A]-1

clc;clearA=[-1.5 1.5 0;0 0 1;3.75 -3.75 0];syms s;i1=eye(3);sia=inv(s*i1-A);pretty(sia)

V005.0

uqq

075.375.310005.15.1

uqq

2

1

2

1

A B

State variables

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Page 8: SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

4.03

5

s6s4s15s156s4s6s415

6s615s4

)15s6s4(s1

)s(U)s(Q)s(Q

2

2

2

2

h

2

1

)0(u)0(q)0(q

]AsI[)s(U)s(Q)s(Q

2

11

h

2

1

)s6s4(*4.0)s15*3(s15*5)15s6s4(s

1)s(U)s(Q 2

2hh2

15s6s44.122s6.1

)15s6s4(ss4.122s6.1

)15s6s4(ss4.2s45s75s6.1

)s(U)s(Q 22

2

2

2

hh2

d)

e)

s2

005.0

s6s4s15s156s4s6s415

6s615s4

)15s6s4(s1

)s(U)s(Q)s(Q

2

2

2

2

Ö

2

1

s2

005.0

]AsI[)s(U)s(Q)s(Q

1

Ö

2

1

234

22

2Ö1 s15s6s415s4

s2

*)15s4(*5.0)15s6s4(s

1)s(Q

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Page 9: SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Example: Write the equation of motion of the mechanical system given below in the State Variables Form. Force applied on the system is F(t)=100 u(t) (a step input having magnitude 100 Newtons) and at t=0 x0=0.05 m and dx/dt=0. Find x(t) and v(t).

)t(Fxkdtdx

cdt

xdm 2

2

State variables are x and v=dx/dt .

)t(Fm1

xmk

vmc

xv

vx

m=20 kg

c=40 Ns/m

k=5000 N/m

)t(Fm/1

0vx

m/cm/k10

vx

)t(F05.00

vx

225010

vx

Matlab program to obtain eigenvalues:

>>a=[0 1;-250 -2];eig(a)

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Page 10: SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

)t(F05.00

vx

225010

vx

Applying Laplace transform and arranging,

)s(F05.00

)s(V)s(X

225010

v)s(sVx)s(Xs

0

0

)s(F05.00

vx

)s(V)s(X

225010

)s(V)s(X

s0

0

)s(F05.00

vx

)s(V)s(X

225010

)s(V)s(X

1001

s0

0

)s(F05.00

vx

)s(V)s(X

AsI0

0

)s(F05.00

AsIvx

AsI)s(V)s(X 1

0

01

Solution due to the inputSolution due to the initial conditions

s25012s

)AsI(Det1

AsI

2s2501s

AsI

1

250s2s)AsI(Det 2

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Page 11: SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

s25012s

250s2s1

AsI 21

s100

05.00

s25012s

250s2s1

005.0

s25012s

250s2s1

)s(V)s(X

22

s100

)s(F

For x(t) ;

clc;clear;num=[0.05 0.1 5];den=[1 2 250 0];[r,p,k]=residue(num,den)

)250s2s(s5s1.0s05.0

)s(X 2

2

250s2s

5.7)s(V 2

clc;clear;syms s;A=[0 1;-250 -2];i1=eye(2); %unit matix with dimension 2x2 siA=s*i1-A;x0=[0.05;0]; %Initial conditionsB=[0;0.05];Fs=100/s;X=inv(siA)*x0+inv(siA)*B*Fs;pretty(X)

s02.0

)i7797.151(si001.0015.0

)i7797.151(si001.0015.0

)s(X

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Page 12: SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

02.0)t7797.15cos(Ae)t(x t rad0.0666)i001.0015.0(angle

0301.0)i001.0015.0(abs*2A

02.0)0666.0t7797.15cos(e0301.0)t(x t

s02.0

)i7797.151(si001.0015.0

)i7797.151(si001.0015.0

)s(X

Steady-state value (Final value)

0 1 2 3 4 5 6-0.01

0

0.01

0.02

0.03

0.04

0.05

0.06

t (s)

x(t)

Initial value, x0

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Page 13: SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

250s2s5.7

)s(V 2 For v(t)

clc;clear;num=[-7.5];den=[1 2 250];[r,p,k]=residue(num,den)

)i7797.151(si2376.0

)i7797.151(si2376.0

)s(V

)t7797.15cos(Ae)t(v t

rad2/)i2376.0(angle4752.0)i2376.0(abs*2A

)57.1t7797.15cos(e4752.0)t(v t

0 1 2 3 4 5 6-0.5

-0.4

-0.3

-0.2

-0.1

0

0.1

0.2

0.3

0.4

t (s)

v(t)

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Page 14: SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Example: Mathematical model of a mechanical system having two degrees of freedom is given below. If F(t) is a step input having magnitude 50 Newtons, find the Laplace transforms of x and θ.

R=0.2 m

m=10 kg

k=2000 N/m

c=20 Ns/m

)t(FRk2xk2xm

0Rk3xRk2RcmR 222

)t(F800x4000x10

0240x8008.04.0

State variables

vx

x

600x2000210

)t(F80x400xv

vx

)t(F

01.0

00

v

x

206002000008040010000100

v

x

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Page 15: SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

clc;clearA=[0 0 1 0;0 0 0 1;-400 80 0 0;2000 -600 0 -2];syms s;eig(A)i1=eye(4);sia=inv(s*i1-A);pretty(sia)

)s(F

01.0

00

]AsI[v

x

]AsI[

)s()s(V)s()s(X

1

0

1

80000s800s1000s2s)s(D 234

If the initial conditions are zero, only the solution due to the input exists. s

50)s(FFor

1]AsI[

Eigenvalues: System is stable since real parts of all eigenvalues are negative.

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

Page 16: SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS

s80000s800s1000s2s3000s10s5

s50

80000s800s1000s2s)600s2s(*1.0

)s(X 2345

2

234

2

s80000s800s1000s2s10000

s50

80000s800s1000s2s2000*1.0

)s( 2345234

)s()s(V)s()s(X

s50

01.0

00

SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS