Questions tagged [function-fitting]

62 questions
0
votes
1 answer

Using nonlinear square fit in C#

I'm trying to find a fit function that has the form: f(x) = P / (1 + e^((x + m) / s) Where P is a known constant. I'm fitting this function to a list of measured doubles (between 20-100 elements) and all these values has a corresponding x-value.…
Benja S
  • 59
  • 6
0
votes
0 answers

nan in numpy dot product

Here below is a piece of code for realizing a 2-layer neuron network for fitting problem in numpy. The activatin function is ReLU. The training algorithm is Adam. The loss function is half of the mean squared error. However, when the batch size is…
0
votes
0 answers

Vary model parameters to fit measured data in Matlab

I have a Matlab function (of 10 independent variables) based on a model (which generates an oscillating curve with varying period). I need to suitably vary the variables to fit measured data to extract model parameters. The measured data is a two…
jam_27
  • 35
  • 1
  • 7
0
votes
0 answers

Fitting a lognormal function to CDF in Python

I have a very large dataset which I need to do some statistical analysis on. The data is too large to read in all at once, so I only have the binned histogram to work off. In particular, I would love to fit the cumulatives (i.e, number of counts to…
0
votes
2 answers

lmfit- tying fitting parameters one to the other

I'm using python lmfit module to fit multiple Gaussian. What I want is to tide one parameter to the other trough mathematical expression, for example: def gaussian(x,a1,c1,w1,a2,w2,c2): g1=a1*np.exp(-(x-c1)**2/(2*w1**2)) …
0
votes
1 answer

How to interpret matlab lsqnonlin output display?

I am fitting a function with different number of floating parameters using lsqnonlin in matlab. The first fitting produces better fitting, resnorm of 2.5. matlab displays: …
Echo
  • 667
  • 3
  • 8
  • 19
0
votes
0 answers

Fitting an nls curve to experimental data and obtaining a fit parameter

I have an ideal curve dataset shown bleow. I made a nls model that describes the ideal dataset. I also have experimental data that I want to plot against the model to find a value for the fit. How do I do this? Caq q Langmuir 0 …
Valerie S
  • 917
  • 2
  • 7
  • 17
0
votes
1 answer

Matlab fitting error using lsqcurvefit

I'm developing code to fit the Gompertz equation to a bacterial growth curve and am practicing with some example data provided at the following website: http://www.math.tamu.edu/~phoward/m442/ia3sol.pdf. According to this code the fit should…
Laura
  • 89
  • 8
0
votes
1 answer

Error-weighted fit using uncertainties in LMFIT

I am trying to fit a model using LMFIT, I can easily do the following: def loss_function(params): residuals = [] for x, measured in ...: y = predict(x, params) residuals.append(y - measured) return residuals params =…
luke14free
  • 2,529
  • 1
  • 17
  • 25
0
votes
1 answer

how to fit a bi-modal distribution to a function matlab

I have a vector named speed containining the speed of 200 walks speed = [normrnd(80,2,100,1); normrnd(120,10,100,1)]; This vector follows a bimodal distribution. steps is another vector contaning the number of steps for each walk: a = 8; b =…
gabboshow
  • 5,359
  • 12
  • 48
  • 98
0
votes
1 answer

How To Fitting Function To Data in C++

Hi I have some data And I want to fit a polinom these data Firstly I think it should be : ax^2 +bx+c and than x+x1=-b/a ;x*x1=c/a And I wrote this code: #include #include #include using namespace std; void…
j.doe
  • 327
  • 7
  • 22
0
votes
1 answer

Fitting a function with lsqcurvefit

I use lsqcurvefit to fit my function. My function is: C_PET (t)=(k_1/(α_2+α_1 ) [(k_3+k_4-α_1 ) e^((-α_1 t) )+(α_2-k_3-k_4 ) e^((-α_2 t) ) ]* C_P (t))+vC_b (t) I went to find the solution, meaning the best fit for my K parametres. The problem…
hajer
  • 11
  • 6
0
votes
2 answers

Very high residual Sum-of-Squares

I'm having a problem with the square sum-of-residues of an fitting. The square sum of the residues is too high which indicates that the fit is not very good. However, visually it looks fine to have this very high residual value ... Can anyone help…
david clarck
  • 157
  • 2
  • 11
0
votes
0 answers

Matlab - MultiStart using lsqcurvefit

I am trying to fit a function using lsqcurvefit linked with MultiStart. The thing is that the obtained results are highly inconsistent with the training data. The whole problem has to do with the frequency response of two RC parallel circuits…
thp
  • 65
  • 6
0
votes
0 answers

fit gaussian distribution to empirical data

I have 2 data vector (data1 in blue, data2 in red) representing some sort of probabilities (they are not really probability, i.e. sum could be different from 1). As you can see from the picture below data1 could be approximated with a Gaussian…
gabboshow
  • 5,359
  • 12
  • 48
  • 98