function [ObjValue] = objfun  (x,par,TiSoc)
% 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
CB = x(:,2);
Ti = TiSoc;
pTi = par.pTi;  % cost for heating
pCB = par.pCB; 	% price of product B

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



