Software Used :- MATLAB

Polynomial Calculation


COMMAND - polyfit(x,y,n)

p = polyfit(x,y,n) finds the coefficients of a polynomial y(x) of degree n that fits the data y best in a least-squares sense, ie trying to minimise the error function (given below), considering the polynomial function to be a linear polynomial in the coefficients (p). It returns the coefficient vector.



COMMAND - poly2sym(p)


poly2sym(p) gives a symbolic polynomial in 'x' with coefficients

from the vector p.


COMMAND - polyval(p,x)


Y = polyval(p,x) returns the value of a polynomial p evaluated at x. p

is a vector of whose elements are the coefficients of the polynomial in descending powers.

Determining Accuracy

Measure of accuracy : Root Mean Square Error

ERMS = [[ΣNn=1{y(xn, p) − tn}2 ] / N ]


where y(xn, p) = value of the polynomial y(x) with the coefficients given by p vector at xn,.

tn = target value at xn

N = number of elements (x) in the data set


Graph Plotting


COMMAND - plot(x,y)

ezplot(y,[x1,x2])


ezplot(y,[x1,x2]) plots y(x) over x1<x< x2