Code covered by the BSD License  

Highlights from
Optimizing breakpoints for Tables

image thumbnail

Optimizing breakpoints for Tables

by

 

MATLAB code to support the "Generating Optimal Tables using MATLAB" webinar.

plotCurrentFit(x, optimValues, state, refFitObj,Xrange,Yrange,M)
% Copyright 2009 The MathWorks, Inc.

function stop = plotCurrentFit(x, optimValues, state, refFitObj,Xrange,Yrange,M)

stop = false;
[x,y] = delta2xy(x,M,Xrange,Yrange);
z = refFitObj(x(:),y(:));

h = findobj('Tag','CurrentFitPlot');
if isempty(h)
    % create plot
    h = figure;
    set(h,'Tag','CurrentFitPlot');
    plot(refFitObj)
end
% add current points
figure(h)
hold on
switch state
    case 'init'
        plot3(x(:),y(:),z,'bo','MarkerFaceColor','b','Tag','StartPoint')
    case 'iter'
        hp = findobj('Tag','CurrentIter');
        if isempty(hp)
            plot3(x(:),y(:),z(:),'ko','MarkerFaceColor','k','Tag','CurrentIter')
        else
            set(hp,'XData',x(:),'YData',y(:),'ZData',z(:))
        end
    case 'done'
        plot3(x(:),y(:),z(:),'go','MarkerFaceColor','g','Tag','FinalPoint')
end
hold off
warning('off','MATLAB:legend:IgnoringExtraEntries');
legend('Surface','Initial','Current','Final')
warning('on','MATLAB:legend:IgnoringExtraEntries');
end

Contact us