www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@conswitch/findOpPoints.m

    function y = findOpPoints(con,Xop)


%  Copyright 2008 The MathWorks, Inc. 

[N,ng] = size(con.OpPoints);

range = getRange( getInputFactors(con) );
% tolerance for comparison
tol = con.Tolerance.*diff(range(:,end-ng+1:end),1);

Neval = size(Xop,1);

OpPoints= con.OpPoints;
% default value for output
y = zeros(1,Neval);
Done = false(1,Neval);
for i = 1:N
    % find current operating point
    CurrentOp= true(1,Neval);
    for j=1:ng
        CurrentOp(CurrentOp)= abs( Xop(CurrentOp,j)-OpPoints(i,j)) < tol(j);
    end
    y(CurrentOp) = i;
    Done = Done | CurrentOp;
    if all(Done)
        break
    end
end