Main Content

Create Optimal Designs

This example shows how to create an optimal design for a polynomial model using the Model-Based Calibration Toolbox™ command-line interface.

Create the Model

You need a model to create an optimal design.

inputs = mbcmodel.modelinput(...
    'Symbol', {'N','L','A'},...
    'Name',   {'n','load','afr'},...
    'Range',  {[1000 5000],[0.2 0.65],[10.9 14.65]});

model = mbcmodel.CreateModel( 'Polynomial', inputs );
model.Properties.Order = [2 2 2];

Create a V-Optimal Design

Create a design for the polynomial model.

optimalDesign = CreateDesign( model,...
    'Type', 'V-optimal',...
    'Name', 'Optimal Design' );

Generate Design

Create a CandidateSet to use.

CandidateSet = optimalDesign.CreateCandidateSet( 'Type', 'Grid' );
CandidateSet.NumberOfLevels = [21 21 21];
% Pass in Generator properties to Generate
optimalDesign = Generate( optimalDesign,...
    'NumberOfPoints', 30,...
    'CandidateSet', CandidateSet,...
    'MaxIterations', 200,...
    'NoImprovement', 50 );

Alternative Way to Generate Design

Instead of passing generator settings to Generate, you can modify the design's generator. The two methods are equivalent, because assigning the generator back to the design causes a call to Generate.

anotherOptimalDesign = CreateDesign( model, 'Type', 'V-optimal', ...
    'Name', 'Another Optimal Design' );
optimalGenerator = anotherOptimalDesign.Generator;
optimalGenerator.NumberOfPoints = 30;
optimalGenerator.CandidateSet.Type = 'Grid';
optimalGenerator.CandidateSet.NumberOfLevels = [21 21 21];
optimalGenerator.MaxIterations = 200;
optimalGenerator.NoImprovement = 50;

Setting the Generator causes Generate to be called.

anotherOptimalDesign.Generator = optimalGenerator;

Optimal Criteria

criteria = OptimalCriteria( optimalDesign );
fprintf( ['Optimality Criteria for "%s":\n',...
    'V = %.3f\nD = %.3f\nA = %.3f\nG = %.3f\n'],...
    optimalDesign.Name, criteria );
Optimality Criteria for "Optimal Design":
V = 0.181
D = 2.492
A = 1.050
G = 0.552

Pairwise Plots Of Design

Plot each input against the others.

subplot(2,2,1);
Scatter2D( optimalDesign, 1, 2 );

subplot(2,2,3);
Scatter2D( optimalDesign, 1, 3 );

subplot(2,2,4);
Scatter2D( optimalDesign, 2, 3 );

Figure contains 3 axes objects. Axes object 1 with title Optimal Design, xlabel n (N) [-], ylabel load (L) [-] contains a line object which displays its values using only markers. Axes object 2 with title Optimal Design, xlabel n (N) [-], ylabel afr (A) [-] contains a line object which displays its values using only markers. Axes object 3 with title Optimal Design, xlabel load (L) [-], ylabel afr (A) [-] contains a line object which displays its values using only markers.

See Also

Topics