A blog to help electrical engineers and students to learn electrical engineering topics. Basic Electrical Engineering, Power Systems, Electrical Machines, tec.. Now special course on MATLAB for Beginners.

Class

Class

Tuesday, August 23, 2016

Polynomials and Curve Fitting in MATLAB

MATLAB provides a number of functions for the manipulation of polynomials. Polynomials are defined in MATLAB as row vectors made up of the coefficients of the polynomial, whose dimension is n+1, n being the degree of the polynomial. Polynomials in MATLAB vector must include all polynomial coefficients, even those that are zero.

MATLAB provides the function polyval to evaluate polynomials. MATLAB does not provide a direct function for adding or subtracting polynomials unless they are of the same order, when they are of the same order, normal matrix addition and subtraction applies. Polynomial multiplication is supported by the conv function. Where we want to divide one polynomial by another, in MATLAB we use the deconv function.

Polynomials and Curve Fitting in MATLAB from Shameer Ahmed Koya

Curve fitting is the process of adjusting a mathematical function so that it lays as closely as possible to a set of data points. MATLAB provides a number of ways to fit a curve to a set of measured data. One of these methods uses the “least squares” curve fit. This technique minimizes the squared errors between the curve and the set of measured data. The function polyfit solves the least squares polynomial curve fitting problem.
submit to reddit