load 'interp.out'
x=interp(:,1);
y1=interp(:,2);
y2=interp(:,3);
y3=interp(:,4);
ex=y1;
maxerr=0;
l2err=0;
for i=1:length(x)
 %ex(i)=x(i)*x(i);
 ex(i)=tanh(20*(x(i)-0.5));
 %ex(i)=tanh(100*(x(i)-0.4))-tanh(100*(x(i)-0.6));
 err=y3(i)-ex(i);
 maxerr=max(maxerr,abs(err));
 l2err=l2err+err*err;
end
maxerr
sqrt(l2err/length(x))
plot(x,y1,'o',x,y2,'x',x,y3,'s',x,ex,'+');