%
% Illustration of k-tanh
% tk(a) = \frac{\e^a - \e^{-a}}{\e^a + \e^{-a}}
% and its derivatives for some values of k.
% TK 14.11.02
%
clear, close all
%
k = 1;
a = -3:0.01:3;
v = exp(-k.*a);
u = exp(k.*a);
%
t = (u - v)./(u + v);
td = k*(1-t).*(1+t);
figure
plot(a,t,a,td,'--')
axis([-3 3 -1.5 5.5])
%
hold on
for k=2:5
   t2 = 2./(1+exp(-2*k*a)) - 1;
   td2 = k*(1-t2.^2);
   plot(a,t2,a,td2,'--')
end
text(-0.25,1.15,'k = 1','FontSize',16);
text(-0.25,4.46,'k = 5','FontSize',16);
set(gca,'FontSize',19);
set(gca,'YTick',[-1 1 3 5]);
set(gca,'XLim',[-3 3]);
set(gca,'XTick',[-3 -1 1 3]);
hold off
%print -deps ktan
