how the software formulates parameter estimation as an optimization problem -凯发k8网页登录

main content

how the software formulates parameter estimation as an optimization problem

overview of parameter estimation as an optimization problem

when you perform parameter estimation, the software formulates an optimization problem. the optimization problem solution is the estimated parameter values set. this optimization problem consists of:

  • xdesign variables. the model parameters and initial states to be estimated.

  • f(x) — objective function. a function that calculates a measure of the difference between the simulated and measured responses. also called cost function or estimation error.

  • (optional) x¯xx¯bounds. limits on the estimated parameter values.

  • (optional) c(x) — constraint function. a function that specifies restrictions on the design variables.

the optimization solver tunes the values of the design variables to satisfy the specified objectives and constraints. the exact formulation of the optimization depends on the optimization method that you use.

cost function

the software tunes the model parameters to obtain a simulated response (ysim) that tracks the measured response or reference signal (yref). to do so, the solver minimizes the cost function or estimation error, a measure of the difference between the simulated and measured responses. the cost function, f(x), is the objective function of the optimization problem.

types

the raw estimation error, e(t), is defined as:

e(t)=yref(t)ysim(t)

e(t) is also referred to as the error residuals or, simply, residuals.

simulink® design optimization™ software provides you the following cost functions to process e(t):

cost functionformulationoption name in gui or command line
sum squared error (default)

f(x)=t=0tne(t)×e(t)

n is the number of samples.

'sse'
sum absolute error

f(x)=t=0tn|e(t)|

n is the number of samples.

'sae'
raw error

f(x)=[e(0)e(n)]

n is the number of samples.

'residuals'

this option is available only at the command line.

custom functionn/a

this option is available only at the command line.

time base

the software evaluates the cost function for a specific time interval. this interval is dependent on the measured signal time base and the simulated signal time base.

  • the measured signal time base consists of all the time points for which the measured signal is specified. in case of multiple measured signals, this time base is the union of the time points of all the measured signals.

  • the simulated signal time base consists of all the time points for which the model is simulated.

if the model uses a variable-step solver, then the simulated signal time base can change from one optimization iteration to another. the simulated and measured signal time bases can be different. the software evaluates the cost function for only the time interval that is common to both. by default, the software uses only the time points specified by the measured signal in the common time interval.

  • in the gui, you can specify the simulation start and stop times in the simulation time area of the simulation options dialog box.

  • at the command line, the software specifies the simulation stop time as the last point of the measured signal time base. for example, the following code simulates the model until the end time of the longest running output signal of exp, an object:

    sim_obj = createsimulator(exp);
    sim_obj = sim(sim_obj);

    sim_obj contains the simulated response for the model associated with exp.

bounds and constraints

you can specify bounds for the design variables (estimated model parameters), based on your knowledge of the system. bounds are expressed as:

x¯xx¯

x¯ and x¯ are the lower and upper bounds for the design variables.

for example, in a battery discharging experiment, the estimated battery initial charge must be greater than zero and less than inf. these bounds are expressed as:

0<x<

for an example of how to specify these types of bounds, see .

you can also specify other constraints, c(x), on the design variables at the command line. c(x) can be linear or nonlinear and can describe equalities or inequalities. c(x) can also specify multiparameter constraints. for example, for a simple friction model, c(x) can specify that the static friction coefficient must be greater than or equal to the dynamic friction coefficient. one way of expressing this constraint is:

c(x):x1x2c(x)0

x1 and x2 are the dynamic and static friction coefficients, respectively.

for an example of how to specify a constraint, see .

optimization methods and problem formulations

an optimization problem can be one of the following types:

  • minimization problem — minimizes an objective function, f(x). you specify the measured signal that you want the model output to track. you can optionally specify bounds for the estimated parameters.

  • mixed minimization and feasibility problem — minimizes an objective function, f(x), subject to specified bounds and constraints, c(x). you specify the measured signal that you want the model to track and bounds and constraints for the estimated parameters.

  • feasibility problem — finds a solution that satisfies the specified constraints, c(x). you specify only bounds and constraints for the estimated parameters. this type of problem is not common in parameter estimation.

the optimization method that you specify determines the formulation of the estimation problem. the software provides the following optimization methods:

optimization method namedescriptionoptimization problem formulation
  • user interface: nonlinear least squares

  • command line: 'lsqnonlin'

minimizes the squares of the residuals, recommended method for parameter estimation.

this method requires a vector of error residuals, computed using a fixed time base. do not use this approach if you have a scalar cost function or if the number of error residuals can change from one iteration to another.

this method uses the optimization toolbox™ function, .

 

 

 

  • user interface: gradient descent

  • command line: 'fmincon'

general nonlinear solver, uses the cost function gradient.

use this approach if you want to specify one or any combination of the following:

  • custom cost functions

  • parameter-based constraints

  • signal-based constraints

this method uses the optimization toolbox function, .

for information on how the gradient is computed, see .

 

 

 

  • user interface: simplex search

  • command line: 'fminsearch'

based on the nelder-mead algorithm, this approach does not use the cost function gradient.

use this approach if your cost function or constraints are not continuous or differentiable.

this method uses the optimization toolbox functions, and . fminbnd is used if one scalar parameter is being optimized. otherwise, fminsearch is used. you cannot specify parameter bounds, x¯xx¯, with fminsearch.

 

 

 

  • user interface: pattern search

  • command line: 'patternsearch'

direct search method, based on the generalized pattern search algorithm, this method does not use the cost function gradient.

use this approach if your cost function or constraints are not continuous or differentiable.

this method uses the global optimization toolbox function, (global optimization toolbox).

 

 

 

see also

| | | | | | | | (global optimization toolbox)

related examples

    more about

      网站地图