Matlab formula optimization: Radial Basis Function
z - matrix of doubles, size Nx2; x - matrix of doubles, size Nx2; sup = x(i, :); phi(1, i) = {@(z) exp(-g * sum((z - sup(ones([size(z, 1) 1]),:)) .^ 2, 2))}; this is a Radial Basis Function (RBF) for logistic regression. Here is the formula: I need your advice, can i optimize this formula? coz it calls millions times, and it takes a lot of time... It seems in your recent edits, you introduced some syntax errors, but I think I understood what you were trying to do (from the first version). Instead of using REPMAT or indexing to repeat the vector x(i,:) to match the rows of z , consider using