www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/+mbcboundary/PointByPoint.m

    classdef PointByPoint < mbcboundary.AbstractBoundary
    %MBCBOUNDARY.POINTBYPOINT point-by-point boundary model class
    %    Point-by-point boundary models can only be created and fitted in the
    %    local boundary tree in a two-stage test plan. A separate boundary
    %    model is fitted to each operating point. Point-by-point boundary
    %    models are only valid at the observed operating points. 
    %
    %    mbcboundary.PointByPoint properties:
    %        Name            - name of boundary model (read only)
    %        NumberOfInputs  - number of inputs (read only)
    %        Type            - boundary model type (read only)
    %        Inputs          - boundary model inputs
    %        FitAlgorithm    - fit algorithm for boundary model
    %        Fitted          - indicates whether boundary model has been fitted (read only)
    %        LocalModel      - definition of local boundary model for every operating point
    %        LocalBoundaries - cell array of local boundary models for each operating point (read only)
    %        OperatingPoints - operating point sites for models (read only)
    %
    %    mbcboundary.PointByPoint methods:
    %        CreateBoundary      - create a new boundary model
    %        getAlternativeTypes - list of alternative boundary model types
    %        Evaluate            - evaluate boundary model
    %        designconstraint    - convert boundary model to a design constraint
    %
    %     Boundary models can be combined using the logical operators &, | and ~.
    %
    %See also Tree, TwoStageTree.Local, Model, getAlternativeTypes
    
   %  Copyright 2009 The MathWorks, Inc.
   
    properties (Dependent)
        %LOCALMODEL definition of local boundary model
        %    LocalModel is the definition of the boundary model used to fit
        %    each operating point. 
        % 
        %See also Model, OperatingPoints, LocalBoundaries
        LocalModel
    end
    properties (Dependent,SetAccess=protected)
        %LOCALBOUNDARIES cell array of local boundary models (read only)
        %    LocalBoundaries is a cell array containing the fitted local
        %    boundary models for each operating point. Point-by-point boundary
        %    models are only valid at the observed operating points.
        %
        %See also LocalModel, OperatingPoints
        LocalBoundaries
        %OPERATINGPOINTS operating point sites for local boundary models (read only)
        %    Point-by-point boundary models are only valid at the observed
        %    operating points. 
        %  
        %See also LocalBoundaries
        OperatingPoints
    end
    
    methods (Hidden)
        function B = PointByPoint(varargin)
           %PointByPoint - constructor not intended for public calls

            B = B@mbcboundary.AbstractBoundary(varargin{:});
        end
    end
    
    methods
        %get and set methods
        function L = get.LocalModel(B)
            con = getlocal(B.Object);
            opts = B.FitAlgorithm;
            if ~isempty(opts)
                opts = getObject(opts);
            end
            L = boundarymodel(con,opts,false);
        end
        
        function B = set.LocalModel(B,L)
            if isscalar(L) && isa(L,'mbcboundary.Model') && isequal(L.Inputs,B.LocalModel.Inputs)
                %scalar mbcboundary.Model with compatible inputs
                B.Object = setlocal(B.Object,dataobject(L));
                % copy fit algorithm
                B.pFitAlgorithm = L.FitAlgorithm;
                B = Reset(B);
            else
                error(message('mbc:mbcboundary:PointByPoint:InvalidValue'))
            end
        end
        
        function OP= get.OperatingPoints(B)
            OP= getSwitchPoints(B.Object);
        end
        
        function L = get.LocalBoundaries(B)
            %LOCALBOUNDARIES local boundary model for each operating point
            
            OpPoints = B.OperatingPoints;
            L = cell(1,size(OpPoints,1));
            if B.Fitted
                fopts = getObject(B.FitAlgorithm);
                for i=1:length(L)
                    con = getlocal(B.Object,i);
                    L{i} = boundarymodel(con,fopts,true);
                end
            end
        end
        
    end
   
      
end