Anda di halaman 1dari 20

Outline

Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
ME 530.343:
Design and Analysis of Dynamic Systems
Lecture 3 Developing Models From Data
Prof. Noah J. Cowan
Friday, January 29, 2010
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Todays Objectives
Linearization Examples
Classic Pendulum Example
Stability
Stable solutions
Unstable solutions
Nonlinear Spring Example
Alternative example: add gravity
Function Identication and Parameter Estimation
Fitting Models to Scattered Data
Quality of Fit
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation

Linearization examples

Function identication and parameter estimation

Fitting models to scattered data


Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Classic Pendulum Example
Stability
Nonlinear Spring Example

+
g
L
sin() = 0 = f (,

) =

+
g
L
sin() = 0
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Classic Pendulum Example
Stability
Nonlinear Spring Example
We want to linearize about the reference angle,
r
.

r
= 0 (since
r
is a constant)
Now, write out Taylor series expansion to the rst derivative. Note
that this is a multivariable expansion in and

r
:
f (,

) f (
r
,

r
) +
f

r
,

r
(
r
) +
f

r
,

r
(

r
)
f (,

) f (
r
, 0) +
f

r
,0
(
r
) +
f

r
,0
(

r
)
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Classic Pendulum Example
Stability
Nonlinear Spring Example
Now we evaluate terms on right hand side:
f (,

) =

+
g
L
sin()
f (
r
, 0) =
g
L
sin(
r
)
f

r
,0
=
g
L
cos(
r
)
f

r
,0
= 1
Thus,
f (,

)
g
L
sin(
r
) +
g
L
cos(
r
)(
r
) + 1(

r
)
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Classic Pendulum Example
Stability
Nonlinear Spring Example
To have a valid solution, the rst term must equal zero (recall that
f (
r
,

r
) = 0):
g
L
sin(
r
) = 0
r
= n
n Z (all multiples of ). Hence
f (,

)
g
L
cos(
r
)(
r
) + (

r
)
where
cos
r
= +1 pendulum is down (n even)
cos
r
= 1 pendulum is up (n odd)
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Classic Pendulum Example
Stability
Nonlinear Spring Example
When
r
= 0, 2, 4, . . .. We assume that
r
= 0, since these
are all equivalent physically.
f (,

)
g
L
(
r
) + (

r
)
=
g
L
+

Last time, we computed the general solution:


(t) =

(0)

n
sin(
n
t) + (0) cos(
n
t),
n
=
_
g
L
We call this neutrally stable since small perturbations neither
grow nor decay in time.
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Classic Pendulum Example
Stability
Nonlinear Spring Example
When
r
= , 3, 5, . . .. For convenience, take
r
= , since
all cases are physically identical.
f (,

)
g
L
(
r
) + (

r
) =
g
L
( ) +

= 0
This can be rewritten as


g
L

= 0
where

= .
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Classic Pendulum Example
Stability
Nonlinear Spring Example
Being more precise with respect to labeling of variables, we showed
last time that

r
=

(t) = Ae
+t
+ Be
t
, =
_
g/L
where
A =

(0) +

(0)

2
B =

(0)

(0)

2
(Note that
r
= just adds a constant oset of 180

to the
solution.)
The solution about the nominal position
r
= is unstable
because e
+t
as t .
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Classic Pendulum Example
Stability
Nonlinear Spring Example
The equation of motion for this system is
m x + b x + f
k
(x) = 0
Where the nonlinear spring follows the equation
f
k
(x) = k(1 e
x
)
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Classic Pendulum Example
Stability
Nonlinear Spring Example
First step: Choose operating (nominal) point
x
r
x
r
= 0
x
r
= 0
Second step: Write perturbations about this nominal point
x = x x
r

x = x x
r
= x

x = x x
r
= x
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Classic Pendulum Example
Stability
Nonlinear Spring Example
Third step: Computer Taylor series expansion to the rst derivative
in the variables of interest (x, x, x):
f (x, x, x) = m x + b x + k(1 e
x
) = 0
f (x, x, x) f (x
r
, x
r
, x
r
) +
f
x

x
r
,0,0
x +
f
x

x
r
,0,0

x +
f
x

x
r
,0,0

x
f (x
r
, x
r
, x
r
) = f (x
r
, 0, 0) = k(1 e
x
r
)
f
x

x
r
,0,0
= ke
x
r
f
x

x
r
,0,0
= b
f
x

x
r
,0,0
= m
f (x, x, x) k(1 e
x
r
) + ke
x
r
x + b

x + m

x
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Classic Pendulum Example
Stability
Nonlinear Spring Example
Fourth step: To have a valid solution, the rst term must equal 0.
Solving for x
r
, we have:
k(1 e
x
r
) = 0, so x
r
= 0
x = x x
r
= x 0 = x
Fifth Step: Write nal linearized equation
m x + b x + kx = 0
This makes sense, because the slope of f
k
(x) is k at x = 0
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Fitting Models to Scattered Data
Quality of Fit
Function identication: The process of identifying or discovering
a function that can describe a particular set of data.
Parameter estimation: The process of obtaining values for the
parameters, or coecients, in the function (whose form is assumed
to be known) that describes the data.
Common function types to represent physical phenomena:
1. The ane function y(x) = mx + b. Note that y(0) = b so it
is not necessarily linear in the sense described above, but we
will still call this tting a linear function.
2. The power function y(x) = bx
m
. Note that y(0) = 0 when
m 0 and y(0) = when m < 0.
3. The exponential function y(x) = be
mx
. Note that y(0) = b.
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Fitting Models to Scattered Data
Quality of Fit
The least-squares method is a systematic and object method of
obtaining a straight-line description of data.
Give a data set (x
i
, y
i
) for i = 1, 2, . . . n.
The least squares criterion states that the line that gives the best
t is the one that minimizes J, the sum of squares of the
residuals:
J =
n

i =1
(mx
i
+ b y
i
)
2
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Fitting Models to Scattered Data
Quality of Fit
You can nd the coecients m and b by setting
J
m
and
J
b
each to
zero, and then solving the resulting linear equations for m and b:
J
m
=
n

i =1
2(mx
i
+ b y
i
)x
i
=
n

i =1
2(mx
2
i
+ bx
i
y
i
x
i
)
= 2
_
n

i =1
x
2
i
_
m + 2
_
n

i =1
x
i
_
b 2
_
n

i =1
y
i
x
i
_
= 0
and
J
b
=
n

i =1
2(mx
i
+ b y
i
) = 2
_
n

i =1
x
i
_
m + 2
n

i =1
b 2
_
n

i =1
y
i
_
= 2
_
n

i =1
x
i
_
m + 2nb 2
_
n

i =1
y
i
_
= 0
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Fitting Models to Scattered Data
Quality of Fit
These two equations can be placed in matrix form as follows:
_
n
i =1
x
2
i

n
i =1
x
i

n
i =1
x
i
n
_ _
m
b
_
=
_
n
i =1
x
i
y
i

n
i =1
y
i
_
This is a system of 2 equations and two unknowns, in matrix form.
Uniqueness of solutions is guaranteed as long as the 2 2 matrix is
nonsingular, that is, the determinant is nonzero.
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Fitting Models to Scattered Data
Quality of Fit
Recall that if the determinant is zero, that is equivalent to saying
that the second equation doesnt add anything new, e.g. consider
the redundant system
x + y = 2
2x + 2y = 4
In matrix form:
_
1 1
2 2
_ _
x
y
_
=
_
2
4
_
and the determinant rst matrix is 1 2 2 1 = 0.
Returning to our case, the system has a unique solution when
n 2 and at least two values for x
i
are distinct.
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data
Outline
Todays Objectives
Linearization Examples
Function Identication and Parameter Estimation
Fitting Models to Scattered Data
Quality of Fit
The least-squares method attempts to minimize J, the sum of
squares of the residuals. Thus J itself is a one reasonable measure
of t.
The sum of squares of the deviation of the y values from their
mean y is
S =
n

i =1
(y
i
y)
which is used to compute the coecient of determination, or
r-squared value, dened as
r
2
= 1
J
S
S measures the spread in the y data around the mean, and J
indicates how much of the data spread is left unaccounted for by
the linear model. In engineering, for a very good t r
2
= 0.99,
although in many scientic elds such as biology, r
2
is signicantly
lower.
Prof. Noah J. Cowan ME 530.343: Design and Analysis of Dynamic Systems Lecture 3 Developing Models From Data