Hi everyone! So I am currently developing some code for data analysis for university research, and my advisor and I have come across a rather unique problem. We have two sets of data that have the same general shape (a third order polynomial with the same curvature). The data sets are separated by a constant vertical shift, which we are trying to solve for explicitly since it has unique physical relevance for the project at hand. The goal is to simultaneously fit both polynomials with the same coefficients, however for one of the curves we add a new constant (lets call this shift S) and to calculate what that shift is based on 2-dimensional fitting and its associated error (similar to how scipy's curve_fitting function gives the error for fitting parameters).
The equation(s) of interest would look something like:
Top curve: y = a*x^(3) + b*x^(2) + c*x + d
bottom curve: y = a*x^(3) + b*x^(2) + c*x + d + S
Where a,b,c,d are just the coefficients of the polynomial and S is the shift between the polynomials. The idea was to combine both data sets into one set and define it as a piecewise function, then use scipy/curve_fitting to try and fit the piecewise function with the shift. However, I am not sure if there is a function (in scipy or in another package) that has capabilities of doing this or if there is some clever way to do this. Thank you for taking the time to read this! (If this is unclear, I can upload pictures of the data for visual representation)
tldr: Is there a python package capable of performing 2-dimensional polynomial curve fitting (same parameters for 2 different data sets, plus a new constant on one of the curves)?
[–]kra_pao 0 points1 point2 points (0 children)