function [ObjValue] = objfun  (x,par)
% evaluating the objective function for the
% simple CSTR. Depending on the input, we ge
% the object-function trajectory or a single value
% Johannes Jäschke
if isvector(x)==0
	CB = x(:,2);
else
	CB =x(2);
end
Ti = par.u.Ti;
pTi = par.pTi;  % cost for heating
pCB = par.pCB; 	% price of product B

ObjValue = -(pCB*CB-(pTi.*Ti).^2);



