Tmax = 1300;

%var0 = [250.0, 0.0050];
var0 = [150.0, 0.0030];

lb =  [50.0, 0.0010];
ub = [250.0, 0.0050];

lbscal = -ones(size(lb));
ubscal =  ones(size(ub));
vscal0 = 2*(var0-lb)./(ub-lb)-1;

options = optimset('Display','iter','LargeScale','off', ...
		   'GradObj','off', 'GradConstr','off', ...
		   'TolCon',0.0001,'TolFun',0.0001,'TolX',0.0001);

[vscal, fval] = fmincon(@condif, vscal0, [], [], [], [], lbscal, ...
			 ubscal, [], options, lb, ub, Tmax);


desvar = lb + 0.5*(1 + vscal).*(ub-lb);

fprintf(1,'Final result from optimization\n');
fprintf(1,'Ucool = %10.5f m/s\n',desvar(1));
fprintf(1,'h     = %10.5f m\n',  desvar(2));
fprintf(1,'Tmax  = %10.5f K', Tmax*(fval+1));
