A greybox model is one that has some theoretical structure but needs extra information to be used in a simulation. Greyboxbuild attempts to complete the model by relating model parameters to experimental data obtained at different operating conditions. Greyboxbuild is closely related to greyboxeval which uses similar techniques to determine if a model can be improved but does not attempt to produce a realistic simulation model.
If the model is of the form:
output=model(input,parameters) with input and output values recorded at different operating conditions, greyboxbuild finds the matrix A that relates the parameters to the operating conditions: parameters = A*conditions by minimising the difference between the data and the model predictions. thus completing the model. Non linear relations can be included by using transforms of the original operating conditions. The model is inverted (see references) so that linear regression term selection techniques can be used to select relevant terms in the A matrix. By default the program linfitregsel is used to select the relevant terms in A, and evaluate the non zero coefficients in A.
The information from the model is given by the function:
[res,der]=resfn(data,i,par) which for the ith data set uses the given parameter values (par) to determine the residues (scaled difference between measured data and model predictions), and optionally derivatives of of the residues with respect to the parameters. The data for all the data sets is provided in any convenient form, such as a matrix, cell array, or struct.
A second function:
[Cond,ps]=condfn(data,i) gives the condition values for the ith data set. An optional second output (ps) gives initial/scale values for the parameters. Note that this second output must be supplied if no initial value for the A matrix is given to greyboxbuild.
[A,info]=greyboxbuild(condfn,resfn,data,vndata,optn) uses the information from the two functions (condfn, resfn) to calculate an A matrix that relates the experimental conditions to the model parameters. In addition to the two functions for accessing the data, this function required the data in the form used by condfn and resfn, and an array (vndata) giving the vector of data set number to be used. The optional argument allows initial values of A (optn.Amat) the be provided and optn.Acode to control which values of A are calculated and selected from. The function greyboxeval can be used to obtain an initial value for A, and to evaluate the model quality.
The quality of the model found depends on the model form, and choice of model parameters and operating conditions, as well as the extent of the data used. The operating conditions should cover the range of interest for the model and not have eigenvalues (diagonal of d, from [u,d,v]=svd(C,0) ) that differ by a large factor in magnitude. The use of part of the data for testing the resulting model is recomended, and evaluation using simulated data is strongly recommended before data collection.
Whiten, W.J., Determination of parameter relations within non-linear models, SIGNUM Newsletter, 29(3-4,) 2-5, 1994.
Xiao, J., Extensions of model building techniques and their applications in mineral processing, PhD thesis, The University of Queensland, 1998.
Bill Whiten (2023). Greyboxbuild: complete a greybox model (https://www.mathworks.com/matlabcentral/fileexchange/40584-greyboxbuild-complete-a-greybox-model), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!