nlgreyest
Estimate nonlinear grey-box model parameters
Description
Examples
Selectively Estimate Parameters of Nonlinear Grey-Box Model
Load data.
load(fullfile(matlabroot,'toolbox','ident','iddemos','data','twotankdata')); z = iddata(y,u,0.2,'Name','两个tanks');
The data contains 3000 input-output data samples of a two tank system. The input is the voltage applied to a pump, and the output is the liquid level of the lower tank.
Specify file describing the model structure for a two-tank system. The file specifies the state derivatives and model outputs as a function of time, states, inputs, and model parameters.
FileName ='twotanks_c';
Specify model orders [ny nu nx].
Order = [1 1 2];
Specify initial parameters (Np = 6).
Parameters = {0.5;0.0035;0.019;...9.81;0.25;0.016};
Specify initial initial states.
InitialStates = [0;0.1];
Specify as continuous system.
Ts = 0;
Createidnlgrey
model object.
nlgr = idnlgrey(FileName,Order,Parameters,InitialStates,Ts,...'Name','两个tanks');
Set some parameters as constant.
nlgr.Parameters(1).Fixed = true; nlgr.Parameters(4).Fixed = true; nlgr.Parameters(5).Fixed = true;
Estimate the model parameters.
nlgr = nlgreyest(z,nlgr);
Estimate a Nonlinear Grey-Box Model Using Specific Options
Create estimation option set fornlgreyest
to view estimation progress, and to set the maximum iteration steps to 50.
opt = nlgreyestOptions; opt.Display ='on';opt.SearchOptions.MaxIterations = 50;
Load data.
load(fullfile(matlabroot,'toolbox','ident','iddemos','data','dcmotordata')); z = iddata(y,u,0.1,'Name','DC-motor');
The data is from a linear DC motor with one input (voltage), and two outputs (angular position and angular velocity). The structure of the model is specified bydcmotor_m.m
文件。
Create a nonlinear grey-box model.
file_name ='dcmotor_m';Order = [2 1 2]; Parameters = [1;0.28]; InitialStates = [0;0]; init_sys = idnlgrey(file_name,Order,Parameters,InitialStates,0,...'Name','DC-motor');
Estimate the model parameters using the estimation options.
sys = nlgreyest(z,init_sys,opt);
Input Arguments
data
—Time domain data
iddata
object
Time-domain estimation data, specified as aniddata
object.data
has the same input and output dimensions asinit_sys
.
If you specify theInterSample
property ofdata
as'bl'
(band-limited) and the model is continuous-time, the software treats data as first-order-hold (foh) interpolated for estimation.
options
—Estimation options
nlgreyestOptions
option set
Estimation options for nonlinear grey-box model identification, specified as annlgreyestOptions
选项设置。
Output Arguments
sys
— Estimated nonlinear grey-box model
idnlgrey
object
Nonlinear grey-box model with the same structure asinit_sys
, returned as anidnlgrey
object. The parameters ofsys
are estimated such that the response ofsys
matches the output signal in the estimation data.
Information about the estimation results and options used is stored in theReport
property of the model.Report
有以下字段:
Report Field | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Status |
Summary of the model status, which indicates whether the model was created by construction or obtained by estimation. |
||||||||||||||||||
Method |
Name of the simulation solver and the search method used during estimation. |
||||||||||||||||||
Fit |
Quantitative assessment of the estimation, returned as a structure. SeeLoss Function and Model Quality Metricsfor more information on these quality metrics. The structure has the following fields:
|
||||||||||||||||||
Parameters |
Estimated values of the model parameters. Structure with the following fields:
|
||||||||||||||||||
OptionsUsed |
Option set used for estimation. If no custom options were configured, this is a set of default options. See |
||||||||||||||||||
RandState |
State of the random number stream at the start of estimation. Empty, |
||||||||||||||||||
DataUsed |
Attributes of the data used for estimation — Structure with the following fields:
|
||||||||||||||||||
Termination |
Termination conditions for the iterative search used for prediction error minimization, returned as a structure with the following fields:
For estimation methods that do not require numerical search optimization, the |
For more information, seeEstimation Report.
Extended Capabilities
Automatic Parallel Support
Accelerate code by automatically running computation in parallel using Parallel Computing Toolbox™.
Parallel computing support is available for estimation using thelsqnonlin
search method (requires Optimization Toolbox™). To enable parallel computing, usenlgreyestOptions
, setSearchMethod
to'lsqnonlin'
, and setSearchOptions.Advanced.UseParallel
totrue
.
For example:
opt = nlgreyestOptions; opt.SearchMethod ='lsqnonlin';opt.SearchOptions.Advanced.UseParallel = true;
Version History
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
运行command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina(Español)
- Canada(English)
- United States(English)
Europe
- Belgium(English)
- Denmark(English)
- Deutschland(Deutsch)
- España(Español)
- Finland(English)
- France(Français)
- Ireland(English)
- Italia(Italiano)
- Luxembourg(English)
- Netherlands(English)
- Norway(English)
- Österreich(Deutsch)
- Portugal(English)
- Sweden(English)
- Switzerland
- United Kingdom(English)