Loop over the values of the sigma-vector - thus call "vpaintegral" for each sigma value separately.
Or alternatively make your code a function and call it from a script with a single sigma-value as input.
Further, I'd recommend first to use "integral" instead of "vpaintegral" to save computation time.
And where do you compute w1 - w6 - the variables you try to plot at the end of your code ?
Works because "vpaintegral" is called for each sigma-value separately:
arrayfun(@(sigma)vpaintegral(f,r,0,sigma),sigma)
Does not work because "vpaintegral" is called once with the complete sigma-vector:
vpaintegral(f,r,0,sigma)
Operands to the logical AND (&&) and OR (||) operators must be convertible to logical scalar values. Use the ANY or ALL functions to reduce operands to logical scalar values.
Error in sym/vpaintegral (line 182)
(isinf(b) && isempty(symvar(b)) && ~isreal(b))