Questions tagged [curve-fitting]

Fitting 1-D curve to data points, minimizing pre-defined error/loss function.

From wiki:

Curve fitting is the process of constructing a curve, or mathematical function, that has the best fit to a series of data points.

3428 questions
1
vote
0 answers

Scipy Optimal parameters not found: Number of calls to function has reached maxfev = 800

Trying for the logarithmic fit on the dataset using the codes posted. I keep getting Optimal parameters not found: Number of calls to function has reached maxfev = 800. Can you help me 1. Resolve the error 2. If the equation I'm using is a good one…
1
vote
0 answers

checking the proximity of two splines in python

I have the necessity to check if two splines are close enough with a certain tolerance to each other. the first spline: spl_psi=scipy.interpolate.UnivariateSpline(t,psi,k=4,s=0) is the "data input" one used to check the second, which is: def…
1
vote
1 answer

Python: fitting matrix equation with shared parameters

I have two equations that originate from one single matrix equation: [x,y] = [[cos(n), -sin(n)],[sin(n), cos(n)]]*[x', y'], where x' = Acos(w1*t+ p1) and y' = Bcos(w2*t + p2). This is just a single matrix equation for the vector [x,y], but it can be…
SuperCiocia
  • 1,823
  • 6
  • 23
  • 40
1
vote
0 answers

fitting function for 3d surface from x,y,z points

How do I fit this data (link to data) to a function? I need a funzion has z=f(x,y). I have tryed to plot the data in 3-d scatter plot and I get this. So far I have tried to build the surface with this code but I find some holes in the surface. from…
1
vote
1 answer

Curve Fitting past last data point(s)

I am trying to fit a curve to a set of data points but would like to preserve certain characteristics. Like in this graph I have curves that almost end up being linear and some of them are not. I need a functional form to interpolate between the…
ThatQuantDude
  • 759
  • 1
  • 9
  • 26
1
vote
1 answer

{OFF} How can I derivate a spline interpolation function on matlab?

I have lab test data from a battery discharge curve. The data consistes in 22 points of voltage versus time. In matlab I have traced an interpolation curve through spline interpolation, but I wish to make the derivative of this plot, how can I do…
SrnLord
  • 111
  • 5
1
vote
1 answer

Writing function for n-numbered term Fourier series in MATLAB?

Using the fit function, the maximum number of terms that can be made using a Fourier fit in MATLAB is 8: f = fit(xs,ys,'fourier8') Unfortunately, an 8-term series isn't going to cut it for my purposes. The goal is to fit a data set with a Fourier…
user7509051
1
vote
1 answer

scipy curve_fit returns initial estimates

To fit a hyperbolic function I am trying to use the following code: import numpy as np from scipy.optimize import curve_fit def hyperbola(x, s_1, s_2, o_x, o_y, c): # x > Input x values # s_1 > slope of line 1 # s_2 > slope of line 2 …
Gert
  • 55
  • 1
  • 7
1
vote
1 answer

lmfit saving function in Python

I've got an issue with save_modelresult(result, 'S:\Doc\Python\Results\modelresult.csv') Well the save is complete, but the organization of this data is very poor. Does anyone know of any tricks/ways how to store my results in organized…
Hiddenguy
  • 547
  • 13
  • 33
1
vote
2 answers

calculate offset and slope of two time series in successive interval (every 24hrs)

i have two time series data with 8280X1 dim each recorded with 10 minutes interval, and i want to calculate offset(y-intercept) and slope(m) of two time series in successive interval(every 24hrs) in easy way. Is there matlab code for that. so far i…
Poly piter
  • 31
  • 4
1
vote
1 answer

Joining of curve fitting models

I have this 7 quasi-lorentzian curves which are fitted to my data. and I would like to join them, to make one connected curved line. Do You have any ideas how to do this? I've read about ComposingModel at lmfit documentation, but it's not clear how…
Hiddenguy
  • 547
  • 13
  • 33
1
vote
1 answer

Lorentzian fit two ways of writing a code

I am struggling right now with Lorentzian curve fit. I'll try to explain my problem. I need to write my own code for Lorentzian curve fit so I can add some stuff to the equations. I've implemented Lorentzian fit with model and def, I've written…
Hiddenguy
  • 547
  • 13
  • 33
1
vote
1 answer

Object function can return None with certain parameters, how to skip or avoid while converging in Curvefit?

In my situation, the objective function is a numerical process contains a root finding process for an equation by bisection method. With certain set of parameters, the equation does not have root for a intermediate variable. I thought making the…
Zhidong Li
  • 61
  • 1
  • 9
1
vote
1 answer

Setting the equation and removing outliers automatically in cftool

I have some data where I need to perform a simple linear regression. The problem is that there are outliers that I need to eliminate so I use cftool and remove them from the regression. I have the following…
enea19
  • 113
  • 1
  • 11
1
vote
1 answer

Improper Input with scipy.optimize.curve_fit, multivariate regression, exponential function

Data df = pandas.read_csv(temp.csv, header=1) def func(x1,x2,x3,a,b1,b2,b3,c): #return(a*np.exp(b1*x1)*np.exp(b2*x2)*np.exp(b3*x3)+c) return(a*np.exp(b1*x1) + b2*x2 + b3*x3 + c def formula_tester(BIO, VAR1, VAR2, VAR3): X =…
J Kelly
  • 480
  • 1
  • 5
  • 15
1 2 3
99
100