Main Content

CreateBoundary

R2026b

Create boundary model

    Description

    BndMdl = CreateBoundary(Tree) creates a new boundary model, BndMdl, from the mbcboundary.Tree object, Tree. The method uses the test plan inputs to define the boundary model inputs. You must call Add to add the new model to the tree.

    example

    BndMdl = CreateBoundary(Tree,Type) creates a new boundary model of the specified Type.

    BndMdl = CreateBoundary(Tree,Type,Property,Value,...) creates a boundary with the specified properties.

    NewBndMdl = CreateBoundary(OrgBndMdl,Type) creates a new boundary model with the same inputs as the current boundary model, OrgBndMdl.

    example

    NewBndMdl = CreateBoundary(OrgBndMdl,Type,Property,Value,...) creates a new boundary model with the specified properties.

    Examples

    collapse all

    Create a boundary model from a test plan boundary tree and fit it to the test plan data.

    Create a project, define inputs, create a test plan, and attach data.

    p = mbcmodel.project;
    Inputs = mbcinputs('Symbol', {'N','L'}', ...
        'Name', {'Speed','Load'}', ...
        'Range', {[800 5000],[0.1 1]}');
    tp = CreateTestplan(p, {Inputs});
    
    Speed = rand(100,1)*4200+800;
    Load = rand(100,1)*0.9+0.1;
    Torque = 0.002*Speed + 3*Load + randn(100,1)*0.5;
    T = table(Speed, Load, Torque);
    writetable(T, fullfile(tempdir,'bnddata.xlsx'));
    d = CreateData(p, fullfile(tempdir,'bnddata.xlsx'));
    AttachData(tp, d);

    Get the boundary tree and create a star-shaped boundary model.

    Tree = tp.Boundary;
    B = CreateBoundary(Tree, 'Star-shaped');

    Add the boundary model to the tree. Adding the model also fits it to the test plan data.

    B = Add(Tree, B);

    Create a new boundary model with the same inputs as an existing boundary, then fit both to the same data to compare them.

    Create and fit a star-shaped boundary model.

    Inputs = mbcinputs('Symbol', {'N','L'}', ...
        'Name', {'Speed','Load'}', ...
        'Range', {[800 5000],[0.1 1]}');
    
    B = mbcboundary.CreateBoundary('Star-shaped', Inputs);
    X = [rand(100,1)*4200+800, rand(100,1)*0.9+0.1];
    B = Fit(B, X);

    Create an ellipsoid boundary from the existing boundary and fit it to the same data.

    B2 = CreateBoundary(B, 'Ellipsoid');
    B2 = Fit(B2, X);

    Create a point-by-point boundary model from a two-stage test plan and set the local boundary type.

    Create a project with a two-stage test plan and attach data.

    p = mbcmodel.project;
    LocalInputs = mbcinputs('Symbol', {'N','L'}', ...
        'Name', {'Speed','Load'}', ...
        'Range', {[800 5000],[0.1 1]}');
    GlobalInputs = mbcinputs('Symbol', {'E'}', ...
        'Name', {'Exhaust'}', ...
        'Range', {[-5 50]}');
    tp = CreateTestplan(p, {LocalInputs, GlobalInputs});
    
    Speed = rand(100,1)*4200+800;
    Load = rand(100,1)*0.9+0.1;
    Exhaust = rand(100,1)*55-5;
    Torque = 0.002*Speed + 3*Load + randn(100,1)*0.5;
    T = table(Speed, Load, Exhaust, Torque);
    writetable(T, fullfile(tempdir,'pbpdata.xlsx'));
    d = CreateData(p, fullfile(tempdir,'pbpdata.xlsx'));
    AttachData(tp, d);

    Create a point-by-point boundary from the local boundary tree and set the local model type to convex hull.

    B = CreateBoundary(tp.Boundary.Local, 'Point-by-point');
    B.LocalModel = CreateBoundary(B.LocalModel, 'Convex hull');

    Add the point-by-point boundary to the local boundary tree.

    B = Add(tp.Boundary.Local, B);

    Input Arguments

    collapse all

    Type of boundary model, specified as a character vector. Type is a property of the mbcboundary.AbstractBoundary class and all subclasses.

    B.Type returns the boundary model type.

    Use the getAlternativeTypes method to find out what types are available for the specified boundary model.

    Available types depend on the boundary model.

    • For mbcboundary.TwoStage, the LocalModel requires a type of either Range or Ellipsoid. GlobalModel requires a type of Interpolating RBF only.

    • For mbcboundary.PointByPoint, the LocalModel type can be any valid type for mbcboundary.Model.

    Note

    You can only create boundaries of type 'Point-by-point' or 'Two-stage' from a local boundary tree or from an existing boundary of type 'Point-by-point' or 'Two-stage'. You cannot create or fit these types of boundary models outside of a project. Fit them by adding the boundary model to the boundary tree. See example below.

    Instance of mbcboundary.Tree class object, specified as an mbcboundary.Tree object.

    Data Types: char | string

    Boundary model property name, specified as a character vector. The allowed values depend on the boundary model type.

    Example: Global,'Star-shaped'

    Boundary model, specified as a boundary model object.

    Data Types: char | string

    Output Arguments

    collapse all

    Boundary model object created by CreateBoundary, returned as a boundary model object.

    Data Types: char | string

    New boundary model object created by CreateBoundary, returned as a boundary model object.

    Data Types: char | string

    Version History

    Introduced in R2009b