function [f,g] = sonar_scale(x, S)
persistent F G;
if isempty(F) || isempty(G)
load('tanhEnv', 'sonar_scale_f', 'sonar_scale_g');
F = sonar_scale_f; G = sonar_scale_g;
end
f = F(x,S);
if nargout > 1
g = G(x,S);
end
end
