Description 
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.
The function:
[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.
greyboxeval http://www.mathworks.com/matlabcentral/fileexchange/40250
linfitregsel http://www.mathworks.com/matlabcentral/fileexchange/40566
optndfts http://www.mathworks.com/matlabcentral/fileexchange/38881
startup_finish http://www.mathworks.com/matlabcentral/fileexchange/39425
Whiten, W.J., Determination of parameter relations within nonlinear models, SIGNUM Newsletter, 29(34,) 25, 1994.
Xiao, J., Extensions of model building techniques and their applications in mineral processing, PhD thesis, The University of Queensland, 1998.
