Function polyval - interpolation:
The function polyval can then be used to compute the polynomial at particular values. For illustration, we could compute at every value in the x vector:
>> curve = polyval(coefs,x)
curve =
63.8857 69.4571 71.3143 69.4571 63.8857
This results in y values for each point in the x vector, and stores them in a vector known as curve. Placing all this together, the script below known as polytemp generates the x &y vectors, that fits a second order polynomial through these points, and plots both points and curve on similar figure.