# Questions tagged [fitting]

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

1,574 questions
Filter by
Sorted by
Tagged with
54 views

### Goodness of fit

I want to evaluate the goodness of two sets or more fitting parameters, using Rsquared and RMSE (root mean square error), Then how to code?) ...
1 vote
55 views

### Finding fit parameters for a 2-dimensional matrix of data if the value of some parameters depend on the row and others on the column

I have some 2-dimensional data of dimension n x m that I suspect has the following structure: ...
1 vote
110 views

### Find the parameter in NDSolve giving the desired solution

EDIT: I've edited many times because the system gives errors when the body is modified all at once. I've simplified the problem. The simplification consists of having reduced the number of parameters ...
109 views

### FindDistribution and parameters

If I generate some data using data = RandomVariate[NormalDistribution[5, 3], 100] Then find the distribution using (1) ...
32 views

For FindFit I want to have a norm that just sums up all residuals. For the sum of absolute values there is NormFunction -> (Norm[#, 1] &), but I don't know ...
150 views

...
1 vote
67 views

### FindFit; not a valid variable [closed]

I am trying to fit the function in model, however I get General::ivar: 5000.` is not a valid variable. this error. My code is that and ...
47 views

### Interpreting Confidence Intervals From NonLinearModelFit

I recently applied a model to some example data using nonlinearmodelfit and, while the fit was seemingly good (R^2=0.987) and the returned parameters were mostly in line with expectations without ...
1 vote
35 views

### Nonlinear Model Fit - Force a Constrain

I am trying to achieve the best fit for a non linear model, yet I need to ensure that certain coefficients return as positive values. I have been looking for similar questions but I have found nothing ...
75 views

### Memory problems when fitting large (correlated) datasets

I am trying to fit some complicated function that depends on 18 parameters. The problematic is that I have a large correlated dataset (336 points). When fitting, for simplicity, taking only the ...
341 views

...
1 vote
58 views

### NonlinearFit with series coefficients

I have a set of data: ...
44 views

### Fit a parametric function to a ListPlot

Imagine I have a list of points that corresponds to points randomly placed on the circumference of a unit circle. I want code that fits a parametric curve corresponding to this list of points. Note ...
172 views

### How can I fill this region?

How can I fill this region? Plot[{x^2, x^2 - 2 x + 1}, {x, -2, 2}, PlotRange -> {Automatic, {0, 0.5}}, GridLines -> Automatic]
1 vote
108 views

### How to recover the original function from a fitting?

Suppose I have an original function as follows fun[x_] := 6*Exp[-4 x^2]; which has the following plot Plot[fun[x], {x, 0, 4}, PlotRange -> All] Then I produce ...
1 vote
85 views

### How to customize the method of fitting to a specific one?

I have a set of data as follows ...
1 vote
123 views

### How to fit a specific range of data?

Let me explain my question by a toy example: Suppose I have a simple Gaussian function as follows: test[x_] = 4*Exp[-(x)^2]; If I its data to a new Gaussian ...
415 views

### Find fit function

I want to find a fit function for the following data. Can someone suggest the best-fit function for the following data? The upper part of the data set is difficult. ...
27 views

### Fitting data with weights in a Log-Log scale

I need help. I have the following dataset: ...
1 vote
161 views

### Is there a way to fit a piecewise linear function to a list?

I need to find a piecewise linear function that is a proper approximation for sunrise/sunset times of each day of year. Due to some limitations, I cannot use any trigonometric functions. So the sine-...
29 views

### Minimizing and marginalizing in Mathematica

Suppose there is a chi-squared function of several parameters, f(x,y,z), and I have to fit one parameter, say "x", while the rest "y" and "z" have to be dealt with in a ...
1 vote
78 views

### How to find the center of gravity of fibers in image

I am trying to find the centers of gravity of my particles in a SEM image. I binarized the image (img) and with the input and help of previous suggestions on that topic (Creating graph out of ...
81 views

### Finding best polynomial approximation for function with complicated form and many terms [closed]

I have a function that contains 50 terms hence, it is a complicated-looking function. Now I expected it to be a polynomial function. How can I get this polynomial fit provided I don't have data, I ...
1 vote
94 views

### Find best fit function for different data set with errors

I have the following 3 data sets for the same quantity with errors as shown in the figure in different colors. How to find the best fit function of 1) each data set separately 2) combined of the 3 ...
253 views

### Fit data with NormalDistribution

Good day to all! I have some data that I would like to fit with a normal distribution: ...
67 views

...
1 vote
42 views

### How to get a function out of NDSolve

I solved a function using NDSolve and got a result. I also have a plot of the function. Could someone point me in the right direction how I can print the explicit data points and/or generate a fit ...
46 views

### How Mathematica searches prediction band lines?

After approximation, for example model=NonlinearModelFit[data, a + b*x + c*x^2, {a, b, c}, x] We can do this ...
1 vote
65 views

### Fitting data using ParametricNDSolve

I have a system of differential equations that are solved using ParametricNDSolve, leaving two variables undefined (m1 and m2) so that they can be fitted to data later. However, Nonlinearmodelfit ...
1 vote
75 views

...
39 views

### Search for fitting parameters for an inverse Laplace function

I am trying to find a suitable parameter for this function, which I got using the Talbot Inverse Laplace method. But since I'm really not a pro in Mathematica, I don't know why I'm getting the ...
75 views

### Plotting data and fitting to a function

I have three sets of data. I would like to plot them in the same graph. Then plot the following fittings to the data. Any help is appreciated! f(v) = (v^2)*exp(-mv^2/2 kb T) f(v) = (v^3)*exp(-mv^2/2 ...
236 views

### Finding fit function for a given data

In the following, there is some data given. How to find the best fit function of one variable with multiple parameters that best describe this data? It's better to check the agreement on the ...
108 views

### LogitModelFit to predict a categorical variable

I am trying to predict life expectancy based on GDP per capita and literacy rate. Life expectancy is coded as low and high, and the two predictor variables are numerical. Here is some sample data: <...
1 vote
90 views

### Fitting an Equation to an Image

I'm very new to data analysis and I'm trying to figure out how I can fit an equation to an image I generated from a large set of data I collected. I'd then want to overlap this plot to the image to ...
1 vote
94 views

### Exponential fit precision lost

I have a data: ...
104 views

### How do i plot a graph for width vs height of the slits from an image

I need to calculate the width of the slits along the length of each slits. I am new to image processing in mathematica and I need to plot a graph showing how the width changes along the length. I have ...
238 views

### Fit function to histogram

I have a list: histx={-56.6335, -57.2327, -57.8607, -57.9682, -57.0061, -57.1872,-56.9209, -56.1284,...}; I managed to create the histogram that I wanted to: But ...
57 views

122 views

### (NLM @ Circular TimeSeries model ) == invalid phase confidence intervals

In the realm of TimeSeries of data with Circular Statistics, NonlinearModelFit (NLM) correctly generates reasonable Standard Error & confidence intervals for phase parameters (phaseCIs) with x-...
88 views

### Fitting data to a system of ODE

I have a system of two ODEs depending on two parameter k,h and I want to find the best k,h to fit some data. To understand if my code works I started generating some fake data from the equations. Here ...