Code covered by the BSD License  

Highlights from
Tips & Tricks: Getting started using optimization with MATLAB

image thumbnail
from Tips & Tricks: Getting started using optimization with MATLAB by Stuart Kozola
Demo files from the August 21, 2008 Webinar

VEMap(x,RPM,Pratio,VE)
function ve = VEMap(x,RPM,Pratio,VE)

x(1) = x(1);%*10000;

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');

ve = interp2(xx,yy,zz,x(1),x(2));

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

Contact us at files@mathworks.com