+ Reply to Thread
Results 1 to 4 of 4

How to force fixed points in polynomial fitting

  1. #1
    Registered User
    Join Date
    11-06-2009
    Location
    Zagreb, Croatia
    MS-Off Ver
    Excel 2003
    Posts
    4

    How to force fixed points in polynomial fitting

    I am fitting my data with a polynomial in Excel. I want to force the fit function to go through the first point and last point of my data.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: How to force fixed points in polynomial fitting

    Not quite sure what you mean. A workbook with some data and knowing what order of polynomial you want would be a good start
    If you upload it we may be able to help.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,454

    Re: How to force fixed points in polynomial fitting

    Unless you've already done the algebra, I find that this is more of an algebra exercise than a programming exercise.

    Regression equation: y=p(x) [p(x) is your polynomial]
    point1: y1=p(x1) solve for one of the polynomial coefficients
    point2: y2=p(x2) solve for a different coefficient
    substitute those expressions back into p(x) to get a new polynomial along with new expressions for y and x.
    Perform the regression on the transformed polynomial.

    I find that the algebra part is usually the hard part, and Excel is no help with algebra. Once you have the transformed values for x and y and the transformed polynomial, the regression part is usually straightforward.

    As Richard says, help us understand the details and what specifically you don't know how to do, and we may be able to help.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Valued Forum Contributor
    Join Date
    07-13-2021
    Location
    California, USA
    MS-Off Ver
    2010
    Posts
    513

    Re: How to force fixed points in polynomial fitting

    @jactex.... Mathematically, in general, I believe we can expect an exact fit only when the number of data points to fit (n+1) is one more than the "degree" of the polynomial (highest power n).

    In that case, we can use Excel LINEST (VBA WorksheetFunction.LinEst) to determine the coefficients, within computational limitations.

    This can be demonstrated with the example below. See the attached image and Excel file.

    Note that the columns "x wgt" (read: x weight) and "y wgt" are used just for creating the example. They are not needed for the LINEST solution.

    Likewise, the formulas in the columns labeled "x" and "y" are used just for creating the example. You might substitute actual data.

    The following LINEST formula is array-entered in A12:G12 (for a 6-degree polynomial):

    =LINEST(B2:B8, A2:A8^{1,2,3,4,5,6})

    Then the following SERIESSUM formula can be used to generate the "est y" (read: estimated y) values in column C:

    =SERIESSUM(A2, 6, -1, $A$12:$F$12) + $G$12

    G12 is not included in the SERIESSUM range, just in case it is zero (unlikely).

    The following formula in the column labeled "est y err" is relative error between "y" and "est y" values:

    =C2/B2 - 1

    Press f9 to generate new examples.

    Note: LINEST can handle polynomials with degree higher than 6. But the XY Scatter chart trendline is limited to degree 6.

    Caveat: LINEST can generate very eccentric curves. Other methods might generate more reasonable curves consistently. But I do not believe they are built-in functions in Excel.


    -----
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by curiouscat408; 05-12-2022 at 10:56 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Using solver for fitting logarithmic curve to data points
    By Thaher in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-02-2011, 04:57 AM
  2. Problems with polynomial curve fitting
    By bertram in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-17-2011, 11:58 PM
  3. forecasting data points through polynomial trend line
    By cjmonks in forum Excel General
    Replies: 1
    Last Post: 06-27-2011, 05:42 PM
  4. fitting polynomial to data
    By DaveKimble in forum Excel General
    Replies: 3
    Last Post: 01-13-2011, 08:51 AM
  5. Fitting data by a cubic polynomial
    By bhokalivarun in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-04-2009, 06:48 AM
  6. Predict Y value inbetween points using a polynomial
    By ringojb in forum Excel General
    Replies: 3
    Last Post: 09-25-2008, 01:43 PM
  7. fitting a polynomial to data
    By Mike Kamermans in forum Excel General
    Replies: 4
    Last Post: 05-11-2006, 03:30 PM
  8. [SOLVED] trend for polynomial curve fitting by regressing
    By vijaya in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-11-2005, 11:55 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1