function[p] =  taper_flat_profile(xi)

xmin=min(min(xi)); xmax=max(max(xi));

x= (xi-xmin)/(xmax-xmin); x=-20 + 200*x;

p = ( (1-x).*exp(-x) + (1+0).*exp(x)+2)./(exp(-x)+exp(x));

pmax=max(max(p)); p=p/pmax;

Ltaper = 0.1*(xmax-xmin);

angle = 1 * pi / 180; 
scale = Ltaper*tan(angle);

p=scale*p;

