Questions tagged [function-fitting]
62 questions
0
votes
0 answers
ODE fitting with Python - least squares takes to long to compute
I'm trying to replicate the results of "Modeling Plasma Virus Concentration during Primary HIV Infection", by fitting the data sets to my ODE.
Essencially I need to fit 4 parameters (d, k, delta, p) to a dif. equation given a data set.
Up until now…

Daniel Fonseca
- 1
- 2
0
votes
0 answers
One parameter fit function for a poisson generated dataset
I have data generated by the following function:
def generator(photons):
runs = 10000
sectors = []
events = np.random.poisson(photons, runs)
for i in events:
hit = np.random.randint(low=1, high=9, size=i)
…

No Telling
- 1
- 1
0
votes
2 answers
How to fit a quadratic equation to a plot obtained from plotmeans function in R
We are analyzing fixed effects heterogeneity across years of a panel database ("mydata") containing values of an economic explained value depending on 12 independent variables. Data correspond to the period 2007-2017 and 142 countries. We use…

jmatosv
- 1
- 1
0
votes
2 answers
Minimizing function in terms of integral - scipy
I want to find the parameter of a function that will result in a specific integral value in a defined interval. To make things simpler, the example below considers the function to be a straight line, and the parameter I want to find is the slope m.…

andrerud
- 146
- 1
- 11
0
votes
0 answers
fitting over a function with a for loop
Dear Stackoverflow community,
I want fit over the following function with curve_fit:
def fct(A, Ravg,sigma,pos,omega, x):
K=integrate.quad(lambda R:np.exp( - (R-Ravg)**2 / (2 * sigma**2) ),Ravg-sigma,Ravg+sigma)
data=[]
for i in…
0
votes
2 answers
Is there an easy way to calculate the gaussian fit for data that has been cut off by pixel saturation?
I have image data for a flash of light where a few of the pixels have reached 255 at the centre of the flash. What would be the best way to go about fitting a 2D gaussian to the data that isn't at 255 in order to model what the hypothetical pixel…

djs22
- 1
- 1
0
votes
2 answers
How to fit data to a given theoretical model in octave/python?
I have file with a column of numerical data and I would like to fit this data to a theoretical function that should described them. The function i want to fin the data on is:
The parameter to fit are the (n,a) is there a way to fit a set of data,…

Andrea
- 135
- 6
0
votes
2 answers
Function fit and data-fitting with AnyLogic sims
In a simulation i get some data looking like a arctan or tanh function.
I want to implement a function fit in Java for getting the parameter of this function for optimization. For other functions i used for example the Apache code for function fit…

Handballer73
- 103
- 5
0
votes
1 answer
How to tell gnuplot to ignore non-converging fits
I am having some issues with finding good initial conditions for a fit that just won't behave.
So I had the idea to Brute-force it by inserting it in a loop that tells gnuplot to keep fitting until he gets a relative deviation of less than 100%…

Defcon97
- 111
- 3
0
votes
1 answer
RuntimeWarning: invalid value non-linear-fit with multiple parameters and independent variable
I just lerned python a couple of weeks ago and I´m currently having a problem with fitting data to a given function. I tried differnt methods to fit my data but I keep getting the error RuntimeWarning: invalid value, or sth similiar (like divided by…

fähnchenImWinde
- 3
- 3
0
votes
0 answers
Symfit runs into singularity while fitting vector function - any alternatives?
I am attempting to fit 2 graphs to 2 different functions that share parameters. The functions are quite complicated, involve atan, ln and fractions.
Symfit seemed to provide functionality for this kind of fitting but the fit runns into…

Shudras
- 117
- 2
- 8
0
votes
1 answer
Gnuplot fitting
I want to fit the following data:
70 0.0429065
100 0.041212
150 0.040117
200 0.035018
250 0.024366
300 0.02017
350 0.018255
400 0.015368
to the following function which is combination of an exponantial and a gaussian functions:
$ f(x)= a1*(a2*…

Kassik
- 3
- 3
0
votes
2 answers
How to program a circle fit in scala
I want to fit a circle to given 2D points in Scala.
Apache commons math has an example for this in java, which I am trying to translate to scala (without success, because my knowledge of Java is almost non existent).
I took the example code from…

Michael W.
- 182
- 1
- 12
0
votes
0 answers
Approximation of a times series with a given function in matlab
I am trying to fit in matlab a temperature time series that follows this kind of function
I would need to retrieve the 8 parameters of the function, putting as boundary lambda=0 and sigma positive.
I tried using the lsqcurvefit function in matlab,…

Alessandro
- 43
- 1
- 4
0
votes
1 answer
Scipy ValueError: object too deep for desired array with optimize.leastsq
I am trying to fit my 3D data with linear 3D function Z = ax+by+c. I import the data with pandas:
dataframe = pd.read_csv('3d_data.csv',names=['x','y','z'],header=0)
print(dataframe)
x y z
0 52.830740 7.812507 …

Dawid
- 1,385
- 1
- 15
- 23