www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtools/@featurecomp/pPlotSurface.m
function pPlotSurface(obj) %PPLOTSURFACE Private method that displays the comparison data % % PPLOTSURFACE(OBJ) plots the surfaces, calculates and displays the errors. % Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc. nGrid = length(obj.CurrentGridVars); if isempty(obj.Feature) || isnull(obj.Feature) ... || isempty(obj.Table) || isnull(obj.Table) obj.Stats.ListText = {}; obj.ComparisonPane.setdata([],[],[],''); elseif nGrid<1 obj.Stats.ListText = {}; obj.ComparisonPane.setdata('Table has no variable inputs.'); elseif nGrid>2 obj.Stats.ListText = {}; obj.ComparisonPane.setdata('Table has more than 2 variable inputs.'); else % Set inputs to the values in the table obj.pGetInputValues; pF = obj.Feature; pM = pF.get('model'); if isempty(pM) || isnull(pM) obj.Stats.ListText = {}; obj.ComparisonPane.setdata([],[],[],''); else FailedMsg = ''; if pF.isFilledByData Model = []; FailedMsg = 'Strategy is filled by data, not by a model.'; else try Strat = pF.evaluategrid(obj.CurrentGridVars); catch Strat = []; FailedMsg = 'Stategy failed to evaluate.'; end try Model = pM.evaluategrid(obj.CurrentGridVars); catch Model = []; FailedMsg = 'Model failed to evaluate.'; end end if ~isempty(FailedMsg) obj.ComparisonPane.setdata(FailedMsg); else % Switch first 2 inputs to match row/col to y/x correctly pGrid = obj.CurrentGridVars; if nGrid>1 pGrid([1 2]) = pGrid([2 1]); end inputData = cell(2, nGrid); inputData(1,:) = pveceval(pGrid, 'getvalue'); inputData(2,:) = pveceval(pGrid, 'getname'); obj.ComparisonPane.setdata(Strat, Model, inputData{:}); end % Fill the error list if ~isempty(FailedMsg) mx = NaN; mn = NaN; te = NaN; else X = Model - Strat; X = X(:); mx = max(abs(X)); te = sum(X.^2); mn = te/length(X); end infostr = {'Maximum absolute error', sprintf('%6.4g',mx); ... 'Mean square error', sprintf('%6.4g',mn); ... 'Total square error', sprintf('%6.4g',te)}; obj.Stats.ListText = infostr; end end