function y = Cheb(c,x)
    a = min(x);
    b = max(x);
    x = (2*x-a-b)/(b-a);
    n = length(c)-1;
    w1 = zeros(size(x));
    y = c(end)*ones(size(x));
    for j = n:-1:1
        w2 = w1;
        w1 = y;
        y = c(j)*ones(size(x))+2*x.*w1-w2;
    end
    y = y - x.*w1;
end

