Code covered by the BSD License  

Highlights from
Global Optimization with MATLAB

image thumbnail

Global Optimization with MATLAB

by

 

Demo files from the 2010 webinar "Global Optimization with MATLAB Products"

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

VEMap(x,RPM,Pratio,VE)
function [ve,varargout] = VEMap(x,RPM,Pratio,VE)
% Helper function for VE optimization

%  Copyright (c) 2010, The MathWorks, Inc.
%  All rights reserved.
x(1) = x(1);%*10000;
if isvector(RPM)
    [RPM,Pratio,VE] = createGridMap(RPM,Pratio,VE);
end

ve = interp2(RPM,Pratio,VE,x(1),x(2));

if isnan(ve)
    ve = -1e10;
end

if nargout > 2
    varargout{1} = RPM;
    varargout{2} = Pratio;
    varargout{3} = VE;
end

end

function [xx,yy,zz] = createGridMap(RPM,Pratio,VE)
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');
end

Contact us