02-lin-fcts

download 02-lin-fcts

of 39

Transcript of 02-lin-fcts

  • 8/4/2019 02-lin-fcts

    1/39

    EE263 Autumn 2007-08 Stephen Boyd

    Lecture 2Linear functions and examples

    linear equations and functions

    engineering examples

    interpretations

    21

  • 8/4/2019 02-lin-fcts

    2/39

    Linear equations

    consider system of linear equations

    y1 = a 11 x 1 + a 12 x 2 + + a 1 n x ny2 = a 21 x 1 + a 22 x 2 + + a 2 n x n...ym = a m 1 x 1 + a m 2 x 2 + + a mn x n

    can be written in matrix form as y = Ax , where

    y =

    y1

    y2...ym

    A =

    a 11 a 12 a 1 n

    a 21 a 22 a 2 n... . . . ...a m 1 a m 2 a mn

    x =

    x 1

    x 2...x n

    Linear functions and examples 22

  • 8/4/2019 02-lin-fcts

    3/39

    Linear functions

    a function f : Rn Rm is linear if

    f (x + y) = f (x ) + f (y), x, y Rn

    f (x ) = f (x ), x Rn R

    i.e. , superposition holds

    xy

    x + y

    f (x )

    f (y)

    f (x + y)

    Linear functions and examples 23

  • 8/4/2019 02-lin-fcts

    4/39

    Matrix multiplication function

    consider function f : Rn Rm given by f (x ) = Ax , where A Rm n

    matrix multiplication function f is linear

    converse is true: any linear function f : Rn Rm can be written asf (x ) = Ax for some A Rm n

    representation via matrix multiplication is unique: for any linearfunction f there is only one matrix A for which f (x ) = Ax for all x

    y = Ax is a concrete representation of a generic linear function

    Linear functions and examples 24

  • 8/4/2019 02-lin-fcts

    5/39

    Interpretations of y = Ax

    y is measurement or observation; x is unknown to be determined

    x is input or action;y is output or result

    y = Ax denes a function or transformation that maps x Rn intoy Rm

    Linear functions and examples 25

  • 8/4/2019 02-lin-fcts

    6/39

    Interpretation of a ij

    yi =n

    j =1

    a ij x j

    a ij is gain factor from j th input ( x j ) to i th output ( yi )

    thus, e.g. ,

    ith row of A concerns ith output

    j th column of A concerns j th input

    a 27 = 0 means 2nd output ( y2 ) doesnt depend on 7th input ( x 7 )

    | a 31 | |a 3 j | for j = 1 means y3 depends mainly on x 1

    Linear functions and examples 26

  • 8/4/2019 02-lin-fcts

    7/39

    | a 52 | |a i 2 | for i = 5 means x 2 affects mainly y5

    A is lower triangular, i.e. , a ij = 0 for i < j , means yi only depends onx 1 , . . . , x i

    A is diagonal, i.e. , a ij = 0 for i = j , means i th output depends only onith input

    more generally, sparsity pattern of A, i.e. , list of zero/nonzero entries of A, shows which x j affect which yi

    Linear functions and examples 27

  • 8/4/2019 02-lin-fcts

    8/39

    Linear elastic structure

    x j is external force applied at some node, in some xed direction

    yi is (small) deection of some node, in some xed direction

    x 1

    x 2

    x 3x 4

    (provided x , y are small) we have y Ax

    A is called the compliance matrix

    a ij gives deection i per unit force at j (in m/N)

    Linear functions and examples 28

  • 8/4/2019 02-lin-fcts

    9/39

    Total force/torque on rigid body

    x 1

    x 2

    x 3

    x 4

    CG

    x j is external force/torque applied at some point/direction/axis

    y R6 is resulting total force & torque on body(y1 , y2 , y3 are x -, y -, z - components of total force,y4 , y5 , y6 are x -, y -, z - components of total torque)

    we have y = Ax

    A depends on geometry(of applied forces and torques with respect to center of gravity CG)

    j th column gives resulting force & torque for unit force/torque j

    Linear functions and examples 29

  • 8/4/2019 02-lin-fcts

    10/39

    Linear static circuit

    interconnection of resistors, linear dependent (controlled) sources, andindependent sources

    x 1

    x 2

    y1 y2

    y3

    ib

    i b

    x j is value of independent source j yi is some circuit variable (voltage, current) we have y = Ax if x j are currents and yi are voltages, A is called the impedance or

    resistance matrix

    Linear functions and examples 210

  • 8/4/2019 02-lin-fcts

    11/39

    Final position/velocity of mass due to applied forces

    f

    unit mass, zero position/velocity at t = 0 , subject to force f (t) for0 t n

    f (t) = x j for j 1 t < j , j = 1 , . . . , n(x is the sequence of applied forces, constant in each interval)

    y1 , y2 are nal position and velocity (i.e. , at t = n )

    we have y = Ax

    a 1 j gives inuence of applied force duringj 1 t < j on nal position

    a 2 j gives inuence of applied force duringj 1 t < j on nal velocity

    Linear functions and examples 211

  • 8/4/2019 02-lin-fcts

    12/39

    Gravimeter prospecting

    j

    gi gavg

    x j = j avg is (excess) mass density of earth in voxelj ;

    yi is measured gravity anomaly at location i , i.e. , some component(typically vertical) of gi gavg

    y = Ax

    Linear functions and examples 212

  • 8/4/2019 02-lin-fcts

    13/39

    A comes from physics and geometry

    j th column of A shows sensor readings caused by unit density anomalyat voxel j

    ith row of A shows sensitivity pattern of sensor i

    Linear functions and examples 213

  • 8/4/2019 02-lin-fcts

    14/39

    Thermal system

    x 1x 2x 3x 4x 5

    location 4heating element 5

    x j is power of j th heating element or heat source

    yi is change in steady-state temperature at location i

    thermal transport via conduction

    y = Ax

    Linear functions and examples 214

  • 8/4/2019 02-lin-fcts

    15/39

    a ij gives inuence of heater j at location i (in C/W)

    j th column of A gives pattern of steady-state temperature rise due to1W at heater j

    ith row shows how heaters affect location i

    Linear functions and examples 215

  • 8/4/2019 02-lin-fcts

    16/39

    Illumination with multiple lamps

    pwr. x j

    illum. yi

    rijij

    n lamps illuminating m (small, at) patches, no shadows

    x j is power of j th lamp; yi is illumination level of patchi

    y = Ax , where a ij = r 2

    ij max {cos ij , 0}(cos ij < 0 means patch i is shaded from lamp j )

    j th column of A shows illumination pattern from lamp j

    Linear functions and examples 216

  • 8/4/2019 02-lin-fcts

    17/39

    Signal and interference power in wireless system

    n transmitter/receiver pairs

    transmitter j transmits to receiver j (and, inadvertantly, to the otherreceivers)

    pj is power of j th transmitter

    s i is received signal power of ith receiver

    zi is received interference power of ith receiver

    G ij is path gain from transmitter j to receiver i

    we have s = Ap , z = Bp , where

    a ij =G ii i = j0 i = j bij =

    0 i = jG ij i = j

    A is diagonal; B has zero diagonal (ideally, A is large, B is small)

    Linear functions and examples 217

  • 8/4/2019 02-lin-fcts

    18/39

    Cost of production

    production inputs (materials, parts, labor, . . . ) are combined to make anumber of products

    x j is price per unit of production input j

    a ij is units of production input j required to manufacture one unit of product i

    yi is production cost per unit of product i

    we have y = Ax

    ith row of A is bill of materials for unit of product i

    Linear functions and examples 218

  • 8/4/2019 02-lin-fcts

    19/39

    production inputs needed

    qi is quantity of product i to be produced

    r j is total quantity of production input j needed

    we have r = AT q

    total production cost is

    r T x = ( AT q)T x = qT Ax

    Linear functions and examples 219

  • 8/4/2019 02-lin-fcts

    20/39

    Network traffic and ows

    n ows with rates f 1 , . . . , f n pass from their source nodes to their

    destination nodes over xed routes in a network

    t i , traffic on link i , is sum of rates of ows passing through it

    ow routes given by ow-link incidence matrix

    A ij =1 ow j goes over link i0 otherwise

    traffic and ow rates related by t = Af

    Linear functions and examples 220

  • 8/4/2019 02-lin-fcts

    21/39

    link delays and ow latency

    let d1 , . . . , d m be link delays, and l1 , . . . , l n be latency (total traveltime) of ows

    l = AT d

    f T l = f T AT d = ( Af )T d = t T d, total # of packets in network

    Linear functions and examples 221

  • 8/4/2019 02-lin-fcts

    22/39

    Linearization

    if f : Rn Rm is differentiable at x 0 Rn , then

    x near x 0 = f (x ) very near f (x 0 ) + Df (x 0 )(x x 0 )

    whereDf (x 0 ) ij =

    f ix j x 0

    is derivative (Jacobian) matrix

    with y = f (x ), y0 = f (x 0 ), dene input deviation x := x x 0 , output deviation y := y y0

    then we have y Df (x 0 )x

    when deviations are small, they are (approximately) related by a linearfunction

    Linear functions and examples 222

  • 8/4/2019 02-lin-fcts

    23/39

    Navigation by range measurement

    (x, y ) unknown coordinates in plane

    ( pi , qi ) known coordinates of beacons for i = 1 , 2, 3, 4

    i measured (known) distance or range from beacon i

    (x, y )

    ( p1 , q1 )

    ( p2 , q2 )

    ( p3 , q3 )

    ( p4 , q4 ) 1

    2

    3

    4

    beacons

    unknown position

    Linear functions and examples 223

  • 8/4/2019 02-lin-fcts

    24/39

    R4 is a nonlinear function of (x, y ) R2 :

    i (x, y ) = (x pi )2 + ( y qi )2 linearize around (x 0 , y0 ): A

    xy , where

    a i 1 =(x 0 pi )

    (x 0 pi )2 + ( y0 qi )2, a i 2 =

    (y0 qi )

    (x 0 pi )2 + ( y0 qi )2 ith row of A shows (approximate) change in i th range measurement for

    (small) shift in (x, y ) from (x 0 , y0 )

    rst column of A shows sensitivity of range measurements to (small)

    change in x from x 0

    obvious application: (x 0 , y0 ) is last navigation x; (x, y ) is currentposition, a short time later

    Linear functions and examples 224

  • 8/4/2019 02-lin-fcts

    25/39

    Broad categories of applications

    linear model or function y = Ax

    some broad categories of applications:

    estimation or inversion

    control or design

    mapping or transformation

    (this list is not exclusive; can have combinations . . . )

    Linear functions and examples 225

  • 8/4/2019 02-lin-fcts

    26/39

    Estimation or inversion

    y = Ax

    yi is i th measurement or sensor reading (which we know)

    x j is j th parameter to be estimated or determined

    a ij is sensitivity of i th sensor to j th parameter

    sample problems:

    nd x , given y

    nd all x s that result in y (i.e. , all x s consistent with measurements) if there is no x such that y = Ax , nd x s.t. y Ax (i.e. , if the sensor

    readings are inconsistent, nd x which is almost consistent)

    Linear functions and examples 226

  • 8/4/2019 02-lin-fcts

    27/39

    Control or design

    y = Ax

    x is vector of design parameters or inputs (which we can choose) y is vector of results, or outcomes

    A describes how input choices affect results

    sample problems:

    nd x so that y = ydes nd all x s that result in y = ydes (i.e. , nd all designs that meet

    specications) among x s that satisfy y = ydes , nd a small one (i.e. , nd a small or

    efficient x that meets specications)

    Linear functions and examples 227

  • 8/4/2019 02-lin-fcts

    28/39

    Mapping or transformation

    x is mapped or transformed to y by linear function y = Ax

    sample problems:

    determine if there is an x that maps to a given y (if possible) nd an x that maps to y

    nd all x s that map to a given y

    if there is only onex that maps to y, nd it (i.e. , decode or undo themapping)

    Linear functions and examples 228

  • 8/4/2019 02-lin-fcts

    29/39

    Matrix multiplication as mixture of columns

    write A Rm n in terms of its columns:

    A = a 1 a 2 a n

    where a j Rm

    then y = Ax can be written as

    y = x 1 a 1 + x 2 a 2 + + x n a n

    (x j s are scalars, a j s are m -vectors)

    y is a (linear) combination or mixture of the columns of A

    coefficients of x give coefficients of mixture

    Linear functions and examples 229

  • 8/4/2019 02-lin-fcts

    30/39

    an important example: x = ej , the j th unit vector

    e1 =

    10...0

    , e2 =

    01...0

    , . . . e n =

    00...1

    then Ae j = a j , the j th column of A

    (ej

    corresponds to a pure mixture, giving only column j )

    Linear functions and examples 230

  • 8/4/2019 02-lin-fcts

    31/39

    Matrix multiplication as inner product with rows

    write A in terms of its rows:

    A =

    a T 1a T 2...a T n

    where a i Rn

    then y = Ax can be written as

    y =

    a T 1 xa T 2 x...a T m x

    thus yi = a i , x , i.e. , yi is inner product of i th row of A with x

    Linear functions and examples 231

  • 8/4/2019 02-lin-fcts

    32/39

    geometric interpretation:

    yi = aT i x = is a hyperplane in R

    n

    (normal to a i )

    a iyi = a i , x = 3

    yi = a i , x = 2

    yi = a i , x = 1

    yi = a i , x = 0

    Linear functions and examples 232

  • 8/4/2019 02-lin-fcts

    33/39

    Block diagram representation

    y = Ax can be represented by a signal ow graph or block diagrame.g. for m = n = 2 , we represent

    y1

    y2= a 11 a 12

    a 21 a 22

    x 1

    x 2

    as

    x 1

    x 2

    y1

    y2

    a 11a 21

    a 12a 22

    a ij is the gain along the path from j th input to ith output (by not drawing paths with zero gain) shows sparsity structure of A

    (e.g. , diagonal, block upper triangular, arrow . . . )

    Linear functions and examples 233

  • 8/4/2019 02-lin-fcts

    34/39

    example: block upper triangular, i.e. ,

    A = A11 A120 A22

    where A11 Rm 1 n 1 , A12 Rm 1

    n 2 , A21 Rm 2 n 1 , A22 Rm 2

    n 2

    partition x and y conformably as

    x =x 1x 2 , y =

    y1y2

    (x 1 Rn 1 , x 2 Rn 2 , y1 Rm 1 , y2 Rm 2 ) so

    y1 = A11 x 1 + A12 x 2 , y2 = A22 x 2 ,

    i.e. , y2 doesnt depend on x 1

    Linear functions and examples 234

  • 8/4/2019 02-lin-fcts

    35/39

    block diagram:

    x 1

    x 2

    y1

    y2

    A11

    A12

    A22

    . . . no path from x 1 to y2 , so y2 doesnt depend on x 1

    Linear functions and examples 235

  • 8/4/2019 02-lin-fcts

    36/39

    Matrix multiplication as composition

    for A Rm n and B Rn p , C = AB Rm p where

    cij =

    n

    k =1a ik bkj

    composition interpretation: y = Cz represents composition of y = Axand x = Bz

    mmn p pzz y yx AB AB

    (note that B is on left in block diagram)

    Linear functions and examples 236

  • 8/4/2019 02-lin-fcts

    37/39

    Column and row interpretations

    can write product C = AB as

    C = c1 c p = AB = Ab1 Ab p

    i.e. , i th column of C is A acting on ith column of B

    similarly we can write

    C =cT 1...cT m

    = AB =a T 1 B...a T m B

    i.e. , i th row of C is i th row of A acting (on left) on B

    Linear functions and examples 237

  • 8/4/2019 02-lin-fcts

    38/39

    Inner product interpretation

    inner product interpretation:

    cij = a T i bj = a i , bj

    i.e. , entries of C are inner products of rows of A and columns of B

    cij = 0 means i th row of A is orthogonal to j th column of B

    Gram matrix of vectors f 1 , . . . , f n dened as G ij = f T i f j(gives inner product of each vector with the others)

    G = [ f 1 f n ]T [f 1 f n ]

    Linear functions and examples 238

  • 8/4/2019 02-lin-fcts

    39/39

    Matrix multiplication interpretation via paths

    a 11a 21

    a21

    a 22

    b11b21

    b21b22

    x 1

    x 2

    y1

    y2

    z1

    z2

    path gain= a 22 b21

    a ik bkj is gain of path from input j to output i via k

    cij is sum of gains overall paths from input j to output i

    Linear functions and examples 239