hw linearcontrol

Upload: muhammad-wahyono

Post on 05-Apr-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 HW LinearControl

    1/32

    1 | P a g e

    HOMEWORKChapter 6-7

    Class: Linear System (Spring 2008)

    Professor: Hansil Kim

    Student: Ha Nguyen Vu

    ID number: 20085165.

    Wireless Communication Lab

    Ulsan, June 16, 2008

  • 8/2/2019 HW LinearControl

    2/32

    2 | P a g e

    Problem 1:Describe: Singular Value Decomposition and LU Decomposition.

    Singular Value Decomposition

    In linear algebra, the singular value decomposition (SVD) is an important factorization of arectangular real or complex matrix, with several applications in signal processing andstatistics. Applications which employ the SVD include computing the pseudo inverse, leastsquares fitting of data, matrix approximation, and determining the rank, range and null spaceof a matrix.Definition : Any real mxn matrix A can be decomposed uniquely by

    TA UDV=

    Where:

    U is a mxm orthogonal matrix (T

    UU I= ) and its columns are eigenvectors ofT

    AA V is a nxn orthogonal matrix ( TVV I= ) and its columns are eigenvectors of

    TA A

    D is a mxn diagonal matrix :

    o 1 2( , ,..., )nD diag = ordered so that 1 2 ... n

    o If 0j with j=1,2,n then j is called singular value and its square is

    an eigenvalue ofT

    A A .

    o If 1 2( , ,..., )nU u u u= and 1 2( , ,..., )nV v v v= then1

    nT

    i i i

    i

    A u v=

    =

    Applications of SVD

    Computing the rank of a matrix using SVDThe rank of a matrix is equal to the number of non-zero singular values

    Computing the inverse of a matrix using SVD

    If with the matrix D of a matrix A has all values 0j for all j,

    We have :1 1 1( ) ( )T T T T AA UD V V D U U DD U UU I = = = =

    And1 1 1( ) ( )T T T T A A VD U U DV V D D V VV I = = = =

    With

    1

    1 2

    1 1 1( , ,..., )

    n

    D diag

    =

    Thus, we can get the inverse of matrix A is :1 1 T

    A VD U = .

  • 8/2/2019 HW LinearControl

    3/32

    3 | P a g e

    Solving a system of linear equations :We have linear equations for a system

    Ax=b

    Where A is a mxn matrix and b is a vector mx1.

    The least-squares solution x with the smallest norm ||x|| is unique and it is givenby:1( )T Tx A A A b A b += =

    Where1

    ( )T T

    A A A A b+ = (The More-Penrose pseudo inverse)

    LU Decomposition

    In linear algebra, the LU decomposition is a matrix decomposition which writes a matrixas the product of a lower and upper triangular matrix. The product sometimes includes apermutation matrix as well. This decomposition is used in numerical analysis to solvesystems of linear equations or calculate the determinant.

    An LU decomposition is a decomposition of the form A = LU

    Where A is an mxnmatrix , L is a lower triangular mxmmatrix and Uan upper triangularmxnmatrix. This decomposition is used to solve systems of linear equations and to find theinverse of a matrix. As we shall notice, if A is a band matrix, then the matrices L and Uareband matrices as well. This is a useful and memory-saving property.

    Here we just concentrate on square matrices. The LU-decomposition of a matrix A isgotten by left multiplying it by so called Gaussian matrices until we have an upper triangularmatrix.

    Constructing LU-decomposition

    Gaussian matrix Let x be an n-vector. We construct a square matrix Lk, such that first kelements of the vector x remain fixed and the rest are changed to zero, And the Gaussianmatrix is:

  • 8/2/2019 HW LinearControl

    4/32

    4 | P a g e

    It is easy to compute the inverse of a Gaussian matrix. The inverse is (show this)

    Multiplying the system of equations by this matrix does not change the solution.Suppose we have a matrix A that is of the following form

    We transform this matrix to an upper triangular matrix by left multiplying it by suitableGaussian matrices. First we use a suitable matrix L1 to transform the first column of A toupper triangular form. Then we use a suitable L2 to do the same thing for the second columnand so on. After n-1 steps we have an upper triangular matrix.

    The 1st Column: We assume, that a110, then choose a Gaussian matrixL1 such thatit transforms the first row of A so that it is parallel with e1. Next we left multiply theequation by the matrix

    We have:

    with component wise representation (with)

    Where a(1)ij are the new elements.

    The 2nd Column: If (1)22

    0a we can use a Gaussian matrix that leaves the first two

    elements of the second column in previous matrix intact and transforms the rest of theelements to zero.

  • 8/2/2019 HW LinearControl

    5/32

    5 | P a g e

    Where(1)

    22 (1)

    22

    3,4,..., .ii

    al i n

    a= =

    and the component wise representation is

    We get the product

    That is:

    The kth Column: We make a description of a general step after we have performed k-1

    steps already. If ( 1) 0kkk

    a .Then we can find a Gaussian matrix, that leaves the first k

    elements of the kth column intact and transforms the others to zero.

    ( 1)

    ( 1)1, 2,..., .

    kik

    ik k

    kk

    al i k k na

    = = + +

    so the Gaussian matrix has the following element wise representation

    Finally k=n-1 and we have

    Where Uis upper triangular as we wanted

  • 8/2/2019 HW LinearControl

    6/32

    6 | P a g e

    The product of two lower triangular matrices that have ones on the diagonal is a lowertriangular matrix that has ones on the diagonal (exercise 1.16.8), so the matrix

    is lower triangular with ones on the diagonal. Now we can write

    `Where Uis an upper diagonal matrix. Because the inverse of a lower triangular matrix

    with ones on diagonal is a lower triangular matrix, we finally get the decomposition wewere after.

    1 .A L U LU= =

    Existence of LU-decomposition

    Now we want to know when the LU-decomposition of a given matrix exists. In construction ofan LU-decomposition we use the elements

    as denominators. These elements and ( 1)nnn

    a are called pivot elements. According to the

    construction of LU-decomposition, it should be clear that if the n-1 first pivot elements differfrom zero then the LU-decomposition of a square matrix A exists.

    Applications

    Solution of a system (nxn) of linear equations by using LU-decomposition.LU-decomposition is mainly used to solve matrix equations Ax=b. First we find the LU-

    decomposition of a matrix A. partial pivoting does not change the solution, because onlythe order of the equations is changed. In complete pivoting we might change the solutionby permuting it since we can change the order of the variables xi. Complete pivoting leadsto an equation of the form.

    that is easy to solve. The inverse of a permutation matrix Pis its transpose, sowe get the equation

    LUx=Pb.We can split this into two halves.Ly=Pb,

    Ux=y.The first equation has a unique solution y=L-1Pb, because L is invertible. The matrix

    Uis an upper triangular matrix that has the pivot elements of A on its diagonal. The latterequation also has a unique solution if all the pivot elements, including the last one, arenonzero.

  • 8/2/2019 HW LinearControl

    7/32

    7 | P a g e

    Finding the inverse of a matrix by using LU-decomposition.LU-decomposition gives us new information about the inverse of a matrix: if det(A) 0,

    then A has an inverse that can be computed by solving the system of equations,

    1,2, .., .i iAx e i n= = This could also be presented in the form

    so AX = I. The properties of the determinant now say thatdet(AX)=det(A)det(X)=1=det(I)

    so det(X) 0, and its easy to find an nxnmatrix Ysuch satisfies the equation:XY=I

    We left multiply the equation by A:

    SoAX=XA =I, and that isX=A-1.

    Problem 2:Describe the adjoint operator and Least Square method.Solve: problem 6.43 and 6.45

    Adjoint Operator

    Consider a linear transformation:

    1 2:A H H Where: 1H , 2H _ inner product spaces ( respectively, 1,< > and 2,< > _ inner products)

    Its mean that:

    1x H 2( )A x y H= .

    If z _ artritrary vector in2

    H then2 2

    , , ( )z y z A x< > =< > is well defined. We can be used

    it to define the adjoint transformation:*

    2 1:A H H With *

    2 1, ( ) ( ), )z A x A z x< > =< >

    It can be shown for finite dimensional spaces that *A is also a linear transformation.

    Properties of adjoint transformations:

    1. In all case we have: *A A= and * *( )A A= .

    If1 2

    :A H H and *2 1

    :A H H . We have: *1 1

    :A A H H and *2 2

    :AA H H .

    If 1H = 2H then*

    A A= and A is called self-adjoint.

    If * *AA A A= are said to be normal transformation.

  • 8/2/2019 HW LinearControl

    8/32

    8 | P a g e

    2. With any linear transformation1 2

    :A H H . Then the linear vector spaces 1H and 2H

    can be written as direct sums :*

    1 ( ) ( )H N A R A= and*

    2 ( ) ( )H N A R A= (*)

    Where:o N(.) and R(.) are the null space and range of the transformations.

    o (.)R denotes the closure of the range R(.).

    It means if ( )x N A and any vector *( )y R A we have =0.

    Equation (*) provides an orthogonal decomposition for 1H and 2H .

    Least Square Method

    Consider the equation: Ax=y (where A is mxn matrix (m>n))With this equation, the sub_equations are often inconsistent to each others and getting aexactly solution is very difficult. In this case, the approximately solution is the best choice,and the Least square method is the one of them.

    Least Square methodTo solve the problem, we set an nx1 error vector e: e = y-Ax.The least-squares approach yields the one x which minimizes the sum of the squares ofthe e(i) components .That is, x is chosen to minimize :

    2 ( ) ( )T TJ e e e y Ax y Ax= = =

    To minimize 2e , we must take the derivation of J and solve incase it equal zeros to get

    the x value which makes

    2

    e is minimum. We have:

    0 ( ) ( ) 0T TJ

    A y Ax A y Axx

    = =

    0T TA y A Ax =

    Thus,1

    ( )T Tx A A A y=

    The matrix 1( )T TR A A A= is a particular example of the generalized or pseudo-inverse of

    A written A+ . If 1A exits, then 1A A+ = and J=0.

    Weighted Least-Squares

    Ignoring some equations or placing equal reliance on all equations represents twoextremes. If some equations are more reliable than others, but all equations are to beretained, a weighted least-squares approximation can be used.That is, x should minimize

    1 1( ) ( )T TJ e R e y Ax R y Ax = =

    Take the derivation:

  • 8/2/2019 HW LinearControl

    9/32

    9 | P a g e

    1 10

    T TJA R Ax A R y

    x

    = =

    We have:1 1 1( )T Tx A R A A R y =

    Exercise 6.43 page 244

    Call the current goes through the circuit is i(t)

    Application the Kirchhoffs Currents Law, we have . '( ) . ( ) 0L i t R i t+ = Using Laplace transform:

    . '( ) . ( ) 0 . . ( ) . (0 ) . ( ) 0Laplace

    L i t R i t L s I s L i R I s+ = + = Wherei(0)is the initial value of the current.And:

    . . ( ) . (0 ) . ( ) 0

    . (0) (0)( )

    L s I s L i R I s

    L i iI s

    RR Lss

    L

    + =

    = =+ +

    Then:

    _(0)( ) ( ) (0).R

    tinv Laplace L

    iI s i t i e

    Rs

    L

    = =

    +

    So we have ( ) (0).R

    tLi t i e

    = .

    Thus the voltage value of R is

    ( ) ( ) . (0). (0).R R

    t tL Lv t Ri t R i e v e

    = = =

    With this equation we can get the form of the vector equation as:V=Et.x

    With V is a vector (nx1) of the array voltage value

    Et is a vector (nx1) of the array value of the functionR

    tLe

    with the time change.

  • 8/2/2019 HW LinearControl

    10/32

    10 | P a g e

    x is the matrix (1x1) present for the value of v(0), now we want to find.

    From the table from the problem we have the value of v(t) with t=0,1,2,3 is.

    [ ]167.9 95.5 88.8 55.3T

    V =

    And the vector Et we can get by calculating the value of the function

    Rt

    Le

    with t=0,1,2,3,R=10 Ohm and L = 3.56 H , we have :

    3 41 0.0602 3.631 10 2.188 10T

    tE =

    Apply the least-squares solution, we have:1

    ( . ) . 0.996375. . 0.9964 173,9837 173.3574T T Tt T t t

    x E E E V E V= = = =

    Finally, we have v(0)=173.3574 (V)So the initial current is

    (0) 173.3574(0) 17.33574( )

    10

    vi A

    R= = =

    Exercise 6.45 page 244

    We have the time ( iT) required to race a distance ( iD ) can be expressed as:

    )(

    iiDCT =

    ( from the exercise)

    Taking logarithm for this equation, we have : 10 10 10ogi iLog T Log C L D= + From the problem, we already have the array values of the ( iT) and ( iD ), here we must

    define the value of C and .

    Calculate the values of 10 iLog T from the above table of iTand iD we have:

    [ ]_ 2.2672 1.9009 1.7782 1.5786 1.0607Log time = And

    [ ]_ tan 1.4183 1.0934 0.9777 0.7924 0.3010Log dis e = Then we have the equations:

    10

    2.2672 1 1.4183

    1.9009 1 1.0934

    .log .1.7782 1 0.9777

    1.5786 1 0.7924

    1.0607 1 0.3010

    C

    = +

  • 8/2/2019 HW LinearControl

    11/32

    11 | P a g e

    Set

    10log CX

    =

    ,

    1 1.41830

    1 1.093421 0.97772

    1 0.79239

    1 0.30103

    A

    =

    and

    2.26717

    1.900911.77815

    1.57863

    1.06069

    Y

    =

    We have: Y=A.X.Apply the least-squares solution, we have:

    1( )T TX A A A Y= =

    1

    5.0000 4.5829 1.4335 1.3458

    4.5829 4.8816 1.3458 1.4683

    T TA Y A Y

    =

    Thus

    10log 0.730

    1.077

    CX

    = =

    Finally: C= 100.73 =5.37 and 1.077 =

    From here we can achieve the equation:1.0775.37 ( istance)Time D=

    So, with D=1 we have :1.077_1 5.37(1) 5,37 min 5min 22T mile s= = =

    Problem 3:

    Describe how to calculate the eigen value and the eigen vector in each case.Solve: problem 7.50 and 7.51

    Eigenvalue And Eigenvector

    Let A be any linear transformation with domain D(A) and range R(A), both contained

    within the same linear vector space H. Let elements of H be denoted asix . Those

    particular elements 0ix and the particular scalars i F which satisfy ( )i i iA x x= are

    called eigenvectors and eigenvalues, respectively.

    Eigenvalue

    In order to find eigenvalues of matrix A, we solve the equation det( ) 0A I = and the

    roots of this equation are eigenvalues.The equation det( ) 0A I = is called characteristic equationof the matrix A.

    Example:

  • 8/2/2019 HW LinearControl

    12/32

    12 | P a g e

    Find the eigenvalue of this matrix

    0 1

    5 6A

    =

    We have the characteristic equation:

    0 (6 ) 5 0 1 5A I or = + = = = So A has two eigenvalues, those are: 1 1 = and 2 5 =

    Eigenvector

    Two find the eivenvectors we must solve the equation . i i iA x x= (*)

    but there are many case of the eigenvalue and sometime is hard to find the eigenvectors.

    Case I : Distinct Eigenvalues

    This is the simplest case, in this case, each eigenvalue has algebraic multiplicity of one,so we have ( ) 1rank A I n = (A_nxn matrix). This means that there is only one

    independent nontrivial solution to the homogeneous equation . i i iA x x=

    Example:Find the eigenvector of matrix A (above).

    weve already had1

    1 = and 2 5 = ..

    o With1

    1 = , the equation (*) will be

    10 11

    15 6

    a a ak

    b b b

    = =

    We chose

    1

    1

    1x

    =

    o With 2 3 = , the equation (*)will be

    10 15

    55 6

    a a ak

    b b b

    = =

    We chose 2

    1

    5x

    =

    So A has two eigenvectors respectively with the eigenvalues1 1 = and 2 3 = those

    are: 11

    1x

    =

    and 2

    1

    5x

    =

    Case II: Repeated Eigenvalues

    In this case, there are one or more eigenvalues are repeated roots of the characteristicequation, a full set of eigenvectors may or may not exist. The number of linearly

    independent eigenvectors associated with an eigenvaluei repeated with an algebraic

    multiplicity im is equal to the dimension of the null space of iA I . This dimension is

    given by ( )i iq n rank A I = and is called the degeneracy of iA I .

  • 8/2/2019 HW LinearControl

    13/32

  • 8/2/2019 HW LinearControl

    14/32

    14 | P a g e

    1 1

    2 2 1

    3 3 2

    1

    i

    i

    i

    mi i mi mi

    Ax x

    Ax x x

    Ax x x

    Ax x x

    =

    = +

    = +

    = +

    (***)

    Example:Find the eigenvalues and eigenvectors of following matrix:

    0 1 0 0

    0 0 1 0

    0 0 0 1

    8 20 18 7

    A

    =

    The characteristic equation:4 3 27 18 20 8 0 + + + + =

    Solve the above equation we have: { }1, 2, 2, 2 1,4i i = = .

    o With 1 1 = we solve as case 1 to get the eigenvector is [ ]1 1 1 1 1T

    x =

    o With2,3,4

    2 = we have2

    3m = and 2 1q =

    For 2 =-2 then we have 2 3m = and 2 ( 2 ) 1q n rank A I = + =

    So we must use (***) to find the eigenvectors:

    Firstly, we find 2x from equation : 2 2iAx x=

    2 2

    2 2

    2 2

    2 2

    0 1 0 0

    0 0 1 02

    0 0 0 1

    8 20 18 7

    a a

    b b

    c c

    d d

    =

    We have:

    2

    1 1 11

    8 4 2

    T

    x

    =

    Second, we find 3x from equation: 3 3 2iAx x x= +

    3 3

    3 3

    3 3

    3 3

    0 1 0 0 1/ 8

    1/ 40 0 1 02

    1/ 20 0 0 1

    18 20 18 7

    a a

    b b

    c c

    d d

    = +

    We have:

  • 8/2/2019 HW LinearControl

    15/32

    15 | P a g e

    3

    3 1 10

    16 4 4

    T

    x

    =

    Finally, we find 4x from equation: 4 4 3iAx x x= +

    4 4

    4 4

    4 4

    4 4

    0 1 0 0 3/16

    1/ 40 0 1 02

    1/ 40 0 0 1

    08 20 18 7

    a a

    b b

    c c

    d d

    = +

    We have:

    4

    3 3 10

    16 16 8

    T

    x

    =

    Case II31 i iq m

    This is the general case for both case II1and case II2 and this case II3 is really just a

    combination of a previous two cases. There will be one Jordan block for eacheigenvector, that is ,

    i will have iq blocks associated with it.

    Example:Let A be a 8x8 matrix and assume that the eigenvalues have been found as

    1 2 2 = = , 3 4 5 6 3 = = = = , 7 8 4 = = .

    If1,2

    ( ) 7rank A I = ;3,6

    ( ) 6rank A I = ;7,8

    ( ) 6rank A I = we have:

    o With 1 2 2 = = , 1 8 7 1q = = the simple degeneracy Case II2, so x1 is a

    eigenvector and x2 is a generalized eigenvector.

    o With3 4 5 6

    3 = = = = , 3 8 6 2q = = case II3 ad there are two eigenvectors

    and two generalized vectors here we will have two Jordan block with eachblock has one eigenvector.

    o With 7 8 4 = = , 7 8 6 2q = = case II1 all the vectors are eigenvectors.

    o Finally there are five eigenvectors (so there are five Jordan blocks) and threegeneralized vectors.

    The Jordan form can be: (there are two ways)

  • 8/2/2019 HW LinearControl

    16/32

    16 | P a g e

    Exercise 7.50 page 281

    This problem just only request to find the maximum value but here I will calculate bothminimum value and maximum value of Q.

    We have

    1

    1 2

    2

    2 2

    1 1 2 2

    ,

    3 1

    1 3

    3 2 3

    T

    Q x Ax

    x Ax

    xx x

    x

    x x x x

    =< >

    =

    =

    = +

    More over:

    ( )( )

    2 2 2 2 2 2 21 1 2 2 1 2 1 2 1 2

    2 2 2 2 2

    1 2 1 2 1 2

    3 2 3 2 2 ( ) 2( )

    4 4 ( ) 4( )

    x x x x x x x x x x

    x x x x x x

    + = + + +

    = + + +

    Thus,2 2 2 2

    1 2 1 22( ) , 4( )x x Q x Ax x x+ = +

    In the other hand, we havex is a unit vector so , 1x x< >= and 2 21 2 1x x+ = ( [ ]1 2T

    x x x= )

    Summarily, 2 4Q

    Then we have:

    The minimum value of Q is 2 when

    1 22 2

    1 1

    01

    x xx x

    = + =

    We have:1 2

    1 1 1 1[ , ] [ , ];[ , ]

    2 2 2 2x x =

    The maximum value of Q is 4 when

    1 2

    2 2

    1 1

    0

    1

    x x

    x x

    + =

    + =

    We have:1 2

    1 1 1 1[ , ] [ , ];[ , ]

    2 2 2 2x x =

    Plotting the Q value by using Matlab program to check the result:

    x=[-1:0.01:1 1:-0.01:-1];

    y=[];

    q=[];

    forii=1:length(x)ifii>length(x)/2

  • 8/2/2019 HW LinearControl

    17/32

    17 | P a g e

    y=[y sqrt(1-x(ii)^2)];

    else

    y=[y -sqrt(1-x(ii)^2)];

    end

    q=[q 3*(x(ii)^2+y(ii)^2)-2*x(ii)*y(ii)];

    end

    plot3(x,y,q);

    Conclusion:In this problem we can solve by change

    2 2 2 2 2 2 2 2

    1 1 2 2 1 2 1 2 1 2 1 23 2 3 2 2 ( ) 4 4 ( )x x x x x x x x x x x x + = + + = + +

    And using the characteristic: the square of a real number is larger than zeros. But in somecase we can not do like that, we will be able to solve the same of this problem by usingLagrange method as:

    Get a function: 2 21 2.( 1)L Q x x= + +

    Then find the minimum and maximum by solving:

    1

    2

    2 2

    1 2

    0

    0

    1 0

    L

    xL

    x

    x x

    =

    =

    + =

  • 8/2/2019 HW LinearControl

    18/32

    18 | P a g e

    Exercise 7.51 page 281:

    Set:

    The eigenvectors and eigenvalues of the simple matrix A is { ix } and{ }i . The matrix Ais presented for the simple linear transformation.

    The reciprocal basis vectors of { ix } is { ir}.

    Its means: . 1T

    i ir x = and . 0 ( )

    T

    i jr x i j=

    `Let i i iE x r= >< , we will prove that iE is a projection onto ( )iN A I .We have:

    Firstly, iE is satisfy the condition ( ). 0i iA I E = :

    i i iE x r= >< Then .

    T

    i i iE x r=

    So:

    ( ). ( ). .( . . ).

    ( . . ). 0

    T

    i i i i i

    T

    i i i i

    T

    i i i i i

    A I E A I x rA x x r

    x x r

    = =

    = =

    Thus iE is onto the null space of ( )iA I (mean ( )iN A I ) Secondly,

    . ( )( )

    ( . )( . ) .( . ).

    .

    i i i i i i

    T T T T

    i i i i i i i i

    T

    i i i i i

    E E x r x r

    x r x r x r x r

    x r x r E

    = >< >< =

    So we have .i i iE E E= And

    . ( )( )

    ( . )( . ) .( . ).

    .0. 0

    i j i i j j

    T T T T

    i i j j i i j j

    T

    i i

    E E x r x r

    x r x r x r x r

    x r

    = >< >

  • 8/2/2019 HW LinearControl

    19/32

    19 | P a g e

    And the transformation:

    1

    1

    1

    1

    1

    1

    . ,

    , .

    , .

    . , (because , and are the number (not a matrix))

    . . .

    .( . ).

    .(

    n

    i i

    i

    n

    i i

    i

    n

    i i i

    i

    n

    i i i i i

    i

    nT

    i i i

    i

    n T

    i i i

    i

    i i

    Ay A r y x

    r y A x

    r y x

    x r y r y

    x r y

    x r y

    x

    =

    =

    =

    =

    =

    =

    = < >

    = < >

    = < >

    = < > < >

    =

    =

    = >

    1 1 1

    ). . . . .n n n

    i i i i i

    i i i

    r y E y E y = = =

    < = =

    So matrix A can be presented by1

    .n

    i i

    i

    A E=

    = with iE is a projection onto ( )iN A I as we

    have just proved.

    Problem 4:Describe the algorithm finding the trajectory of the linear or nonlinear differential equation.Present 5 examples in the second or the third order differential equations, and calculate

    the trajectory of them with any initial condition by simulation with C programming or Matlab.

    The method to finding the trajectory of the linear differential equation:

    The second order differential equation:We consider the form of the second order differential equation of a linear system like:

    '' . ' 0x a x bx+ + = with ' xxt

    =

    Here I will introduce the method to draw the trajectory of this equation.We have:

    '' . ' 0x a x bx+ + = If we set:

    1x x= and 2 'x x=

  • 8/2/2019 HW LinearControl

    20/32

    20 | P a g e

    We have:

    1 2

    2 2 1

    '

    '' . ' . .

    x x x

    x x a x b x a x b x

    = =

    = = =

    So we have

    1 1

    2 2

    0 1.

    x x

    x xb a

    =

    Simply,

    .X A X= with 1

    2

    xX

    x

    =

    and

    0 1A

    b a

    =

    From here we can solve the problem by three ways:

    1. The first, we can calculate the eigenvalues of A and then find the form of x1 andx2 like:

    1 2

    1 1 2 2( ) . . . .t t

    x t k a e k a e

    = + Where

    k1,k2 are the constant. a1,a2 are the eigenvectors of matrix A. 1 , 2 are the eigenvalues of matrix A.

    With the initial condition of X, we can define the value of k1and k2 then we willdraw the trajectory of the system.

    2. The second, we will not solve the equations, we will base on each equation tofind the relation between x1 and x2 and using the numerical method to find thetrajectory of the system:The algorithm can be show follow:

    We have:

    11 2

    dxx x

    dt= = and 2

    2 2 1. .

    dxx a x b x

    dt= =

    Divide two equations above we have:

    2 2 1

    1 2

    . .dx a x b x

    dx x

    =

    We using the approximately form:

    2 2 1

    1 2

    . .x a x b x

    x x

    =

    With the value of 1x we can find the value 2x by above formula.

    Finally, with a recently position1 2( , )x x we can calculate the value

    (1

    x ,2

    x ) so then we can achieve the next position 1 1 2 2( , )x x x x+ + and

    then step by step we can draw the trajectory.

  • 8/2/2019 HW LinearControl

    21/32

    21 | P a g e

    Algorithm:o Get the initial condition [x1(0);x2(0)].

    o Fix | 1x |= the sign of 1x is depend on the value of 2x .

    If 2 0x > then 1 0x >

    If2

    0x < then1

    0x <

    This to be sure its satisfied that x1 and x2 have the right variationwhen time change.

    o Calculate 2 ( 1)x k + , 1( 1)x k+ and 2( 1)x k+

    2 12 1

    2

    . ( ) . ( )( 1) .

    ( )

    a x k b x k x k x

    x k

    + =

    1 1 1( 1) ( )x k x k x+ = +

    2 2 2( 1) ( ) ( 1)x k x k x k+ = + +

    o Finish the repeat after a number step is large enough (N).

    Matlab program:

    function hw_ls2_2(a,b,m,n,N,d_x)

    x1=[];

    x1=[x1 m];

    x2=[];

    x2=[x2 n];

    forii=1:N

    ifx2(ii)>0

    d_x1=d_x;

    else

    d_x1=-d_x;end

    d_x2=-(a*x2(ii)+b*x1(ii))*d_x1/x2(ii);

    tam1=x1(ii)+d_x1;

    tam2=x2(ii)+d_x2;

    x1=[x1 tam1];

    x2=[x2 tam2];

    end

    plot(x1,x2);

    (a,b coefficient of the differential equation

    m,n is the initial condition

    N the number of repeat

    d_x is the value of 1x )

    This algorithm is not good because we fix the value of the1x so the

    trajectory is not smooth when the trajectory is conventional. To overcome

    this problem we must find a good relation function between 1( 1)x k + and

  • 8/2/2019 HW LinearControl

    22/32

    22 | P a g e

    2( )x k so that 1x and 2x will come to zeros when there is the

    conventional effect.Another way to solve the above problem and I think it is better if we use a

    variant time to define1

    x and 2x and this way will be introduces

    3. The third, we do as the second method, but we dont need to fin the relationbetween the x1 and x2, we just use the numerical method to define the next

    position base on the relation between ( 1x , 2x ) and t .

    We have:

    11 2

    dxx x

    dt= = and 2

    2 2 1. .

    dxx a x b x

    dt= =

    We use the approximation here to get:

    12 1 2

    .x

    x x x tt

    = =

    22 1 2 2 1

    . . ( . . )x a x b x x a x b x t t

    = = +

    Then we can calculate easily the next value.

    The Algorithm:o Set t .o Set the initial value [x1(0);x2(0)].o Calculate:

    1( 1)x k + , 1( 1)x k+ , 2 ( 1)x k + , 2( 1)x k+ base on 1( )x k 2( )x k and t .

    Do as follow:

    1 2( 1) ( ).x k x k t + = 2 2 1( 1) ( . ( ) . ( ))x k a x k b x k t + = +

    1 1 1( 1) ( ) ( 1)x k x k x k+ = + +

    2 2 2( 1) ( ) ( 1)x k x k x k+ = + +

    o Finish the repeat at the time value we want.

    Matlab program

    function hw_ls2_3(a,b,m,n,T,d_t)

    t=0:d_t:T;

    tam1=m;tam2=n;

    x1=[];

    x2=[];

    forii=1:length(t)

    ifii==1

    x1=[x1 tam1];

    x2=[x2 tam2];

  • 8/2/2019 HW LinearControl

    23/32

    23 | P a g e

    else

    k=tam2*d_t+tam1;

    tam2=tam2-(a*tam2+b*tam1)*d_t;

    tam1=k;

    x1=[x1 tam1];

    x2=[x2 tam2];

    end

    end

    plot(x1,x2);

    (a,b coefficient of the differential equation

    m,n is the initial condition

    T the time we want to draw the trajectory

    d_t is the value of t )

    Example 1: Draw the trajectory of this equation:x+4x+3x=0

    Solving:We set:

    1 2

    2 2 1

    '

    '' 4. ' 3 4. 3.

    x x x

    x x x x x x

    = =

    = = =

    So we have

    1 1

    2 2

    0 1.

    3 4

    x x

    x x

    =

    Here we draw by 3 method.

    The first method we calculate to get the eigenvalue and eigenvector of A as:The eigenvalue

    1 = and 3 = The eigenvector

    1

    1

    and1

    3

    So we have:1 3

    1 2

    2

    ( ) 1 1( )

    ( ) 1 3

    t tx t

    x t c e c ex t

    = = +

    With 1

    2

    (0)(0)

    (0)

    xx

    x

    =

    we have

    1 1 2

    2 1 2

    (0)

    (0) 3

    x c c

    x c c

    =

    = +

    Thus1 2 1 2

    1 2

    3. (0) (0) (0) (0)and

    2 2

    x x x xc c

    + += =

    The second and the third will be show by the graph

  • 8/2/2019 HW LinearControl

    24/32

    24 | P a g e

    The trajectory of the equationx+4x+3x=0 with the initial condition is

    1

    2

    (0) 3(0)

    (0) 3

    xx

    x

    = =

    Conclusion:o With the method 1 we can draw exactly the trajectory because it defines

    exactly the function of each stage (x1;x2) but its complex with mathematicsolving the equations.

    o The method 2 and method 3 are simpler than the method 1 because wejust use the numerical method to draw the trajectory. Thus, they are easy toapply for the more complex equation.

    o However, between method 2 and method 3 we can recognize that themethod 3 is better than the others because it is closer with the trajectory(method 1) than the method 2 and it doesnt have the fluctuation when thetrajectory converges to the zeros point.

    o So I will use the third method to draw all following examples.

  • 8/2/2019 HW LinearControl

    25/32

    25 | P a g e

    Using the method 3 to draw some others case of equation above:

    (x1 ,x2 )= (-4,1);(-2,4) and (-3,3). (x1 ,x2 )= (2,2);(2,4) and (3,3).

    (x1 ,x2 )= (-2,-2);(-2,-4) and (-3,-3). (x1 ,x2 )= (1,-4);(2,-4) and (3,-3).

  • 8/2/2019 HW LinearControl

    26/32

    26 | P a g e

    Example 2: Draw the trajectory of this equation:x+x+x=0

    We use the matlab function of the method 3 with the coefficient isa=1, b=1:

    The non-linear second order differential equation:

    '' . 'x a x b xc+ + =

    Processing similar with the linear equation

    We set:1x x= and 2 'x x=

    We have:

    1 2

    2 2 1

    '

    '' . ' . .

    x x x

    x x a x b x c a x b x c

    = =

    = = + = +

    Also:

  • 8/2/2019 HW LinearControl

    27/32

    27 | P a g e

    1 1

    2 2

    0 1 0.

    1

    x xc

    x xb a

    = +

    It has a form: .X A X Bc= + with 1

    2

    xX

    x

    =

    0 1A

    b a

    =

    0

    1B

    =

    Here we can draw by method 3 with the algorithm:

    We have:

    11 2

    dxx x

    dt= = and 2

    2 2 1. .

    dxx a x b x c

    dt= = +

    We use the approximation here to get:

    12 1 2.

    xx x x t

    t

    = =

    22 1 2 2 1

    . . ( . . )x

    a x b x c x a x b x c t t

    = + = +

    Then we can calculate easily the next value.

    The Algorithm:o Set t .o Set the initial value [x1(0);x2(0)].o Calculate:

    1( 1)x k + , 1( 1)x k+ , 2 ( 1)x k + , 2( 1)x k+ base on 1( )x k 2 ( )x k and t .

    Do as follow:

    1 2( 1) ( ).x k x k t + =

    2 2 1( 1) ( . ( ) . ( ) )x k a x k b x k c t + = +

    1 1 1( 1) ( ) ( 1)x k x k x k+ = + +

    2 2 2( 1) ( ) ( 1)x k x k x k+ = + +

    o Finish the repeat at the time value we want.

    Matlab program is similar:function hw_nls2_3(a,b,c,m,n,T,d_t)

    t=0:d_t:T;

    tam1=m;

    tam2=n;

    x1=[];

    x2=[];

    forii=1:length(t)ifii==1

    x1=[x1 tam1];

    x2=[x2 tam2];

    else

    k=tam2*d_t+tam1;

    tam2=tam2-(a*tam2+b*tam1-c)*d_t;

    tam1=k;

  • 8/2/2019 HW LinearControl

    28/32

    28 | P a g e

    x1=[x1 tam1];

    x2=[x2 tam2];

    end

    end

    plot(x1,x2);

    Example 3: Draw the trajectory of this equation x+3x+2x=1

    We use the matlab function above with the coefficient isa=3, b=2, c=1:

    The third order differential equation

    I will solve for the non-linear system equation first and linear system is a specialcase of non-linear.

  • 8/2/2019 HW LinearControl

    29/32

    29 | P a g e

    We have the third order differential equation has the form as:

    ''' . '' 'x a x b xcx d+ + + =

    Processing similar with the second order differential equationWe set:

    1x x= ; 2 'x x= and 3 ''x x=

    We have:

    1 2

    2 3

    3 3 2 1

    '

    ''

    ''' . '' ' . . .

    x x x

    x x x

    x x a x b x cx d a x b x c x d

    = =

    = =

    = = + = +

    Matrix form:

    1 1

    2 2

    3 3

    0 1 0 0

    0 0 1 . 0

    1

    x x

    x x d

    x c b a x

    = +

    It has a form:

    .X A X Bd= + with1

    2

    3

    x

    X x

    x

    =

    0 1 0

    0 0 1A

    c b a

    =

    0

    0

    1

    B

    =

    Here we can draw by method 3 with the algorithm:

    We have:

    11 2

    dxx x

    dt= =

    2

    2 3

    dxx x

    dt= =

    and 23 3 2 1. .

    dxx a x b x cx d

    dt= = +

    We use the approximation here to get:

    12 1 2

    .x

    x x x tt

    = =

    23 2 3

    .x

    x x x tt

    = =

    33 2 1 3 3 2 1. . . ( . . . ).

    xa x b x c x d x a x b x c x d t

    t

    = + = + +

    Then we can calculate easily the next value.

    The Algorithm:o Set t .o Set the initial value [x1(0);x2(0);x3(0)].o Calculate:

    1( 1)x k + , 1( 1)x k+ , 2 ( 1)x k + , 2( 1)x k+ , 3 ( 1)x k + , 3 ( 1)x k+

  • 8/2/2019 HW LinearControl

    30/32

    30 | P a g e

    base on 1( )x k 2 ( )x k 3( )x k and t .

    Do as follow:

    1 2( 1) ( ).x k x k t + =

    2 3( 1) ( ).x k x k t + =

    3 3 2 1( 1) ( . ( ) . ( ) ( ) ).x k a x k b x k cx k d t + = + + and

    1 1 1( 1) ( ) ( 1)x k x k x k+ = + +

    2 2 2( 1) ( ) ( 1)x k x k x k+ = + +

    3 3 3( 1) ( ) ( 1)x k x k x k+ = + +

    o Finish the repeat at the time value we want.

    Matlab program is similar:

    function hw_nls3_3(a,b,c,d,x1_0,x2_0,x3_0,T,d_t)

    t=0:d_t:T;tam1=x1_0;tam2=x2_0;

    tam3=x3_0;

    x1=[];

    x2=[];

    x3=[];

    forii=1:length(t)

    ifii==1

    x1=[x1 tam1];

    x2=[x2 tam2];

    x3=[x3 tam3];

    else

    k=tam2*d_t+tam1;

    l=tam3*d_t+tam2;

    tam3=tam3-(a*tam3+b*tam2+c*tam1-d)*d_t;

    tam1=k;

    tam2=l;

    x1=[x1 tam1];

    x2=[x2 tam2];

    x3=[x3 tam3];

    endend

    plot3(x1,x2,x3);

  • 8/2/2019 HW LinearControl

    31/32

    31 | P a g e

    Example 4: Draw the trajectory of this equation x+2x+1.5x+x=0

    This example is presented for the third-order linear differential equationI chose d_t=0.01 and T=200

  • 8/2/2019 HW LinearControl

    32/32

    Example 5: Draw the trajectory of this equation x+3x+2x+1x=4

    This example is presented for the third-order non-linear differential equationI chose d_t=0.01 and T=200