Dear Quentien and Dongwoo (for a reply after a 4-year wait!)
For polynomial approximation in nonstandard domains, we would suggest Vandermonde with Arnoldi
https://people.maths.ox.ac.uk/trefethen/vandermonde.pdffor which code is available in the paper. One can combine it with Lawson iterations to get a minimax approximant. Below is an example code and output.
ep = 0.1;
N = 1000; % #samples
n = 40; % degree
x = linspace(ep,1,N); x = sort([-x x]); % domain is [-1 -ep] cup [ep 1]
x = x(:); % x is a vector of sampled values in the domain
f = @(x)sign(x); F = f(x);
[d,H,Q] = polyfitA_Lawson(x,F,n); % core bit, polyfitA as in paper plus Lawson iterations.
p = @(y) polyvalA(d,H,y);
plot(x,f(x)-p(x)),shg, grid on
% p is a polynomial. if necessary, one form chebfun equal to p by: p = chebfun(@(x)p(x));
I hope this helps.
Yuji