I am assuming you mean to find the values of your function g(x) over all values defined in r2. If a, b, and c are scalars, then the only change you need is to use the element-wise power operator: .^
r2 = 0:0.1:10;
g = a + b*r2 + c*r2.^2;
Then you can plot g against r2 to view the results. For example:
plot(r2,g)
plot(r2,g,'o')
scatter(r2,g)