function w=rbf2weight(x, y, u, sigma)

phi = exp(-dist2(x, u)/(2*sigma^2));

pseudo_inv = inv(phi' * phi) * phi';

w = pseudo_inv * y';
