function stop = VEPlot(x,optimValues,state)
stop = false;
x(1) = x(1);%*10000;
% Create contour plot
h = findobj('Tag','VEMapPlot');
if isempty(h)
load VEData
Xeval = linspace(1000,6000,300)';
Yeval = linspace(0,1,300)';
% Make them into a grid for use in surf
[xx,yy] = meshgrid(Xeval,Yeval);
zz = griddata(RPM,Pratio,VE,xx,yy,'cubic');
contourf(xx,yy,zz,[0 0.2 0.4 0.6 0.7 0.75 0.8 0.85 0.9 0.92 0.94 0.96 1.0])
xlabel('Revolutions Per Minute, RPM')
ylabel('Pressure Ratio')
colorbar
set(gca,'Tag','VEMapPlot')
hold on
hi = plot(x(1),x(2),'ko-','MarkerFaceColor','k');
set(hi,'Tag','PlotOfIterates')
hold off
else % update plot with next point
hi = findobj('Tag','PlotOfIterates');
if isempty(hi)
hold(h)
hi = plot(x(1),x(2));
set(hi,'Tag','PlotOfIterates')
else
set(hi, 'XData', [get(hi,'XData'), x(1)])
set(hi, 'YData', [get(hi,'YData'), x(2)])
end
end
drawnow
if exist('optimValues','var')
iter = optimValues.iteration;
if iter < 10
iterStr = ['VEPlot0',num2str(iter)];
else
iterStr = ['VEPlot',num2str(iter)];
end
end