A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Questions tagged [fitting]

Questions on the use of Mathematica to construct models for approximating empirical data.

Filter by
Sorted by
Tagged with
0
votes
1answer
1k views

Obtaining the envelope of an oscillating function and perform fitting

There is an elegant way to obtain the envelope of an oscillation function explained here https://mathematica.stackexchange.com/a/27854/15966 My question is how to modify the code below so I can fit ...
1
vote
2answers
582 views

On Parameter Estimation using FindDistributionParameters

I would like to estimate the parameters associated with a distribution following the Laplace distribution. I have created experimental data following the Laplace distribution, using the following ...
4
votes
2answers
2k views

In a ListPlot of LinearModelFit, plot error band

This is similar to this question. The fitted line can be plotted alongside with the data with this code: Show[ListPlot[data], Plot[lm[x], {x, 0, 5}]] I would ...
2
votes
1answer
138 views

Trouble with using a log10 function in NonlinearModelFit

I was wondering why won't mathematica give a result where the function is also Log10, instead it gives the ordinary Log. Is it ...
1
vote
0answers
80 views

A more efficient way of fitting a non-linear model that returns an entire list?

I have a function that takes two parameters, del and nu, and returns a list npoints long ...
1
vote
1answer
1k views

Find polynomial equation for set of 3D data

data was given in columns in the order {y, x, z}, with y dependent on x, z ...
1
vote
1answer
2k views

How do I fit NDSolve result to experimental data? [duplicate]

I have two coupled ordinary differential equations which I solve numerically in Mathematica, but now I want to fit the solution with experimental data. I do following, (the experimental data ...
6
votes
3answers
276 views

Looking for ideas for handling a complicated fitting problem

I have the following data: ...
1
vote
1answer
872 views

Fitting Function with 3 parameters

I am trying to fit a function with 3 parameters however the result strongly depend on the initial values of parameters: ...
0
votes
1answer
1k views

Discrete peaks to curve via Voigt summation

I have two data sets. One is an experimental recording of an absorption spectrum, composed of regularly spaced (wavenumber, intensity) coordinates with a fine wavenumber resolution, thus making ...
5
votes
0answers
149 views

Third syntax version of LogitModelFit: unexpected result of “BestFit”

The third listed syntax version of LogitModelFit allows one to specify input in a simple way: Only a design matrix (with a row of values of the explanatory input ...
2
votes
2answers
612 views

Fitting a variable using multiple equations

I would like to find the best fit of two variables for a number of approximate equations, such as: 1x+2y+2=7.04 2x+y+4=7.98 1.5x+1.5y-2=2.53 1.8x+3y-1=6.77 That ...
5
votes
0answers
487 views

Module in numerical model for NonlinearModelFit is slow and leaks memory

I am trying to make a NonlinearModelFit where the model is the result of a numerical calculation. My code works, but it is very slow and also seems to have a memory ...
2
votes
1answer
1k views

Model fitting to noisy data with a custom minimization function

I'm looking into fitting some data with Mathematica. I've got my head around how NonlinearModelFit works (I've been using the Levenberg-Marquardt algorithm for some ...
0
votes
2answers
418 views

Least Square Fitting

stuck on a mathematica assignment and could really use some help. A) Fit a function with the shape log(Y) = a0 + a1log(U) to the datapoints (log(Ui), log(Yi) with an least square fitting. Show this ...
17
votes
3answers
593 views

Disentangling the data

An experiment yields a functional dependence on two variables $F(x,y)$, can be imagined as a 2D map. It is known that the function can be factored as follows $F(x,y)=fx(x) gy(y) +gx(x) fy(y)$. Given ...
1
vote
1answer
120 views

Inaccuracy of Piecewise function? [duplicate]

I have the following issue and can't find a solution so far. ...
0
votes
1answer
134 views

Trouble fitting an explicitly complex model with the TransformedFit package

This is follow up from a previous question in which @Oleksandr R. suggested the use of a package he developed for splitting a model and data into real and imaginary parts to avoid a problem with ...
0
votes
1answer
889 views

NMinimize holding problem

I have a function that I want to minimize numerically through an NMinimize command (because it's very complicated analytically). The minimizer call looks as follows: ...
1
vote
1answer
1k views

Multiple Linear Regression - obtaining equation with constant term

I am trying to use the LinearModelFit function to obtain a linear regression of my 5 inputs for my single output. I have the input data: ...
8
votes
1answer
3k views

Fitting piecewise functions

I have several large data sets which follow the following pattern: A position is measured, a force is applied until a new equilibrium is found. I'd like to find a fit for the position, at least at the ...
5
votes
1answer
149 views

What does LinearModelFit depend on except for its arguments?

I thought this would be always true, but most likely it returns false. ...
1
vote
2answers
457 views

How to fit exponential function which is not converging

I performed an experiment where I measured diffusion in a lipid bilayer. I performed the measurement by fluorescently labeling some molecules in the bilayer, and the irradiating them with light ...
13
votes
1answer
823 views

Fit two intersecting straight lines in Mathematica

I am trying to do a Kurie analysis of the double beta decay of Strontium-90. Here we have two straight sections, and I need to obtain a value for the intersection along with an error for it. I ...
7
votes
1answer
1k views

Fitting a numerical integral via NonLinearModelFit to magnetic data

I'm new to Mathematica and I'm currently trying to fit $$m_T (H,T) = N_T \int\limits_0^{\infty} \frac{x k_\text{B} T}{\mu_0 H} \mathcal{L}(x) \text{pdf}(D_\text{mag}) \text{d}D_\text{mag}$$ with $x=\...
1
vote
1answer
1k views

show fit information on plot

After performing a fit in Mathematica, I would like to show the fitted parameters in a box on the plot showing the fitted function. How would I go about achieving that? Here is a MWE: ...
1
vote
3answers
239 views

Confidence Regions for NonLinearFit with “complicated” integral model

I have a set of data $y_i (z_i)$ with errors $\Delta y_i$, that can be found here Here Thus first, I call the data ...
0
votes
1answer
1k views

Fitting to a sigmoidal model

I am trying to fit a set of stochastic data to a sigmoidal function, but it's not working. Can you please help? Here is the function I am trying to fit to my data. ...
8
votes
1answer
592 views

Inconsistent DistributionFitTest results?

In pondering this question, I used Mariana's function to generate the following data. ...
1
vote
1answer
431 views

NonLinearFit with “complicated” integral model

I have a set of data $y_i (z_i)$ with errors $\Delta y_i$ ...
13
votes
2answers
6k views

What is the best distribution for my histogram?

I defined a security bound for a random walk (cube with 15 length) and I have this code to obtain a sample of the random times at which the random walk crosses the boundary for the first time: ...
1
vote
1answer
1k views

FindFit::nrlnum What am I doing wrong?

I have a model called qobs: ...
2
votes
1answer
217 views

NonlinearModelFit with a matrix as weights

I have to fit a non linear model to my data and I am trying to use NonlinearModelFit. The problem is that I have systematic errors, so the ...
1
vote
1answer
2k views

FindFit (Jacobian Error) [duplicate]

I, like others before me, am struggling with FindFit. So, I tried a simple example. ...
-1
votes
1answer
153 views

How to fit one parametric array to another numerical array?

I have two arrays of length n. One of them is obtained by experiment, so every element of the array is a number. The other array is parametric, each element is a ...
2
votes
0answers
919 views

Speeding up Nonlinearmodelfit by constraining parameters?

I have a complicated parametric PDE that can be fitted to some data with NonlinearModelFit, but takes several hours to estimate the best values of the four free parameters. Currently, the code ...
0
votes
1answer
1k views

Nonlinear fit with piecewise functions

I have an ensemble of data points $(x_i,y_i)$ and I need to fit them according to $y=F(a,b,x)$ if $x \leq x_{ref}$ and $y=G(c,d,x)$ if $x \geq x_{ref}$. The parameters I need to adjust are then $a,b,c,...
2
votes
1answer
782 views

Fitting data using a series of Sin and Cos

I have the following data representing the normal displacement caused by a normal load applied at the middle cross section of a cylinder: I've made the data available here. I am trying to fit using ...
1
vote
1answer
977 views

Can ParametricNDsolve be used for coupled PDEs with 5 parameters?

I have a system of coupled PDEs with five parameters that I only know ranges for rather than explicit values, and I was wondering if I could define a parametric equation with ParametricNDSolve and ...
5
votes
1answer
2k views

Fit data with linear combinations of Cos and Sin

Recall that if $f$ is a piecewise continuous function on the interval $[-\pi, \pi]$, then the Fourier series of $f$ is $$f(x) = \sum_{n=0}^{\infty} (a_n \cos(nx) + b_n \sin(nx)).$$ See for example, ...
7
votes
1answer
7k views

NonlinearModelFit does not find a good fit

I am trying to fit my data to the following function, $$\frac{a b t \left(\log \left(\frac{-a d t+a t-1}{a d t}\right)-2\right)}{4 (a t-1)}-c$$ ...
1
vote
2answers
225 views

Minimizing the maximal residual in mathematica

With this: d1 = 10; d2 = 4; mat = RandomReal[{-1, 1}, {d1, d2}]; vec = RandomReal[{-1, 1}, d1]; LeastSquares[mat, vec] ...
2
votes
0answers
2k views

histogram fit for probability density [closed]

I am trying to fit the (probability density) histogram of some data with the exponential function, but I am having difficulties. My raw data are in file called ...
1
vote
2answers
341 views

FindFit giving weird values on a logistic equation

I was trying to fit a set of data onto a logistic equation, however it ended up telling me that the initial value when $t=0$ is greater than the maximum limit, thus I am led to believe that it isn't ...
0
votes
1answer
682 views

Exporting tables of interpolating functions

A few weeks ago I asked a question about manipulating parameters in NDSolve (Looping with NDSolve?) , and received some very helpful advice about the manipulate environment; now I want to take the ...
5
votes
2answers
3k views

Line of best fit on LogLog plot

I have a LogLog plot, and i'm unsure about how to fit a line to it. The data represents a calibration curve. ...
0
votes
1answer
141 views

Replicating Excel output using Mathematica

I have 2 columns of data in Excel. One is inputs the other is outputs. I ask Excel to make a graph of that data and to fit the data to a power trendline. Excel does this and it's fine as far as it ...
2
votes
2answers
981 views

Can't find a fit for Erf

I have the following numbers ...
1
vote
2answers
143 views

How can I get a fully functional FittedModel when fitting data to a pointwise function?

When I am fitting data with a pointwise function using NonlinearModelFit, the produced FittedModel fails to calculate variances ...
0
votes
1answer
102 views

Constraining some rows from LeastSquares to lines

For two matrices, A and B, with dimensions {n,p} and ...