필터 지우기
필터 지우기

Help with finding and plotting interpolating polynomials

조회 수: 5 (최근 30일)
Steven
Steven 2012년 4월 20일
I already plot using lagrange and newton polynomial but I need help with finding and plotting the interpolating polynomials by system of equations. It doesn't say anywhere in my textbook on how to do this so I need help.
Here is the data I'm given for the problem:
Given the (fictitious) gasoline price data over 10 years,
Year, x 1986 1988 1990 1992 1994 1996
Price (¢),y 113.5 132.2 138.7 141.5 137.6 144.2
a simple interpolating polynomial is proposed as:
y(x)= c0 + c1x + c2x^2 + c3x^3 + c4 x^4 + c5 x^5
Then I am asked to find it by using:
a) System of equations
b) Lagrange polynomial
c) Newton polynomial
Please I need help for the system of equations part.
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 4월 20일
duplicate is at http://www.mathworks.com/matlabcentral/answers/35883-help-with-an-interpolation-problem

댓글을 달려면 로그인하십시오.

답변 (1개)

Richard Brown
Richard Brown 2012년 4월 20일
I presume you mean c0 + c1x + c2x^2 + c3x^3 + c4 x^4 + c5 x^5
The system of equations method means treating c0 ... c5 as unknowns, plugging each data point into the equation, and forming a matrix (Vandermonde) equation to solve for the resulting linear equations in c0 ... c5. That should hopefully be enough to get you back underway
  댓글 수: 4
Steven
Steven 2012년 4월 20일
so what do the c's correspond to?
Walter Roberson
Walter Roberson 2012년 4월 20일
Suppose you had x = 1, 2, 3, and y = 5, 8, 13. That would correspond to y = x^2 + 4, or y = 1 * x^2 + 0*x + 4, or c0 = 4, c1 = 0, c2 = 1. In order of descending coefficients, [1 0 4] . Now, does the 1 or the 4 correspond to one of the values [1 2 3] or [5 8 13]? No --the [1 0 4] are simply coefficients that make the polynomial work.
Extending this example with three values to the more generalized form,
y1 = c2*x1^2 + c1*x1 + c0
y2 = c2*x2^2 + c1*x2 + c0
y3 = c2*x3^2 + c1*x3 + c0
where x1, x2, x3 and y1, y2, y3 are known, then
let D = ((-x2+x1) * (-x3+x2) * (-x3+x1))
and then
c0 = ((x2*y3-x3*y2)*x1^2+(-x2^2*y3+x3^2*y2)*x1+x2*y1*x3*(-x3+x2)) / D
c1 = ((-y3+y2)*x1^2+(y3-y1)*x2^2+x3^2*(y1-y2)) / D
c2 = ((y3-y2)*x1+(-y3+y1)*x2-x3*(y1-y2)) / D
You can see that there is a _relationship_ between the x/y values and the c* coefficients, but you can also see that the c* are certainly not either the x or y values directly.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by