Note the for loop as shown above has another problem: it will allocate memory for a growing array on the fly. You can save some time by allocating memory for the output array in advance, e.g.
vector_y = zeros(size(vector_x));
before the loop. But the simplest and fastest solution for that task would be
vector_y = vector_x .^ 2; % . denotes element wise operation
Faster by a factor 1000 compared to the loop!