# Curve Fitting - Linear Algebra

6 de Jun de 2020
1 de 13

### Curve Fitting - Linear Algebra

• 1. Submitting to - Naveen Kumar S B Professor Science & Humanities Presented by - Gowtham CR – PES1201801581 Nithin Chandra R – PES1201801340 Branch & Section – EEE 4’A
• 2. Curve Fitting is the process of constructing a curve, or mathematical function, that has the best fit to a series of data points.
• 3.  Matrix is one of the most thought and used form or method to simplify such problems.  It’s the same case here, we used matrix method which includes matrix inversion.  Matrix method is also helpful in storing the inputs(co-ordinate points) in the form of matrix.
• 4.  To find the curve equation using the inputs(co-ordinate points), it need’s users effort to solve for it each and every time.  So, coding it wouldn't just nullify the users efforts but also he/she can visualize the curve by plotting it .  The code is user friendly which even permits the user to choose the degree of polynomial which should less them number of inputs.  More the no.of inputs more close it is to the expected equation.
• 5. Any polynomial of order ‘n’ can be expressed as: Y = a*xn+ b*x(n-1) + c*x(n-2) + ….. + k*x(n-(n-1) + C In here, by substituting the value of ‘x’ and ‘Y’ accordingly, We find a set of linear equations with constants a, b, c,….., k, C to be unknowns. Solving for those and substituting them back to the general equation, we could find the expected equation.
• 6.  We’ve used matrices and inverse method to find the best fitting curve –  Let’s consider the degree of polynomial m=3. And the number of co- ordinate points, which should be greater than or equal to m+1, to be n=4.  We know that any cubic equation should be of the form Y = Ax3+Bx2+Cx+D.  Substituting ‘x’ and ‘Y’ values of each of the co-ordinate points. We get 5 equations each with 4 common unknowns A, B, C and D.
• 7.  Now we use linear algebra to find these unknowns by inserting the values of ‘Y’ in a matrix and the co-efficient of A, B, C and D in another matrix.  Let's, name these matrixes Q and P respectively.  P*A = Q, wherein A is the matrix of Constants. A = inverse (P)*Q || if inverse of P exists or else A = (inverse (transpose (P)*(P)))*(transpose (P)*Q) || in which left inverse for the matrix ‘P’ is given by (inverse (transpose (P)*(P)))*(transpose (P))  We got all the constants which are placed back in the general equation.  The required polynomial if found out and it has been plotted in the graph.
• 8. Advantages -  As mentioned before reduces human efforts and user can view the equation’s graphical representation.  Could be used any number of times and for any degree of polynomial.  Could be used to convert any non-polynomial( exponential, trigonometric, etc..,) into a approximate polynomial function. Disadvantages –  Non-polynomial output can’t be obtained.
• 11. For the input a. Degree of the Polynomial (m) = 3 b. Number of co-ordinate points (n) = 4 c. (0, -12), (1, -12), (-1, -6), (2, 0) are the co-ordinate points which are in (x, y) format.