Questions tagged [fitting]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
29 views

Calculate and plot mean values of pairs of data points

I have a list of data points where there can be multiple y values for a given x value, e.g., {{0, 4}, {1, 2}, {1, 3}, {2, 3}}. I would like to Take the mean of the y values for each x value. Get a ...
0
votes
0answers
39 views

Non linear fit data

I am trying to fit this data with this two models. In the first one, the solution is too far from the exact values. In the second one, there is an error. Could you please help? ...
0
votes
1answer
62 views

Logistic fit of data

I would like to use LogitModelFit to find the logistic function to my data. The error I obtain is LogitModelFit::binrsp: The response values are expected to be ...
0
votes
2answers
88 views

How to correctly show the slope of a linear part on LogPlot

I need to plot an Interpolation function of one independent variable (only a 3kB file) on LogPlot and show the slope of its linear part together on the ...
0
votes
1answer
52 views

Why does the FindFormula result contain Abs in result?

If you look at the first example of FindFormula, why is the result Mathematica produces showing an Abs? Table[{x, N[x Sin[x]]}, {x, 0, 4, .3}] FindFormula[%, x] ...
1
vote
1answer
48 views

Restricting a function to prevent divide by zero errors when used in NonlinearModelFit

I have a function which I would like to fit to some data: $$f(\nu) = \sqrt{\left(\frac{A^{2} (\nu \cos(2 \pi T \nu_{0}) \sin(2 \pi T \nu) - \nu_{0} \cos(2 \pi T \nu) \sin(2 \pi T \nu_{0}))^{2} }{\pi^{...
0
votes
1answer
55 views

Approximating missing data points in a list using fit models [closed]

Suppose I have the following list: l={0, 76, 413, 942, 1344, 1651, 1486, 1013, 581, 237, 65, 17, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} I want to find a fit ...
0
votes
0answers
32 views

Get R^2 value between interpolating functions and a list of points

I am looking to compare the degree of accuracy of a theoretical model by comparing my theoretical curve to my experimental data points. My theoretical curve is an interpolating function generated ...
0
votes
0answers
33 views

How to fit a spline (not interpolate) through points in 3D?

I have coordinates of points in 3D and want to fit a spline through these points. I found a least square approach for 2D case: https://demonstrations.wolfram.com/...
2
votes
1answer
60 views

NonlinearModelFit won't fit to gaussian data

The form I'm using should be correct because when I input my initial guesses it plots a shape similar to my data. When I use NonlinearModelFit, the fit is not correct at all and is almost flat, then ...
1
vote
0answers
41 views

FindFormula: can I change the standard TargetFunctions?

FindFormula seems to have a limited number of TargetFunctions: Possible functions for TargetFunctions are Plus, Times, Power, Sin, Cos, Tan, Cot, Log, Sqrt, Csc, Sec, Abs, and Exp. Is it ...
1
vote
1answer
79 views

How to fit spline through points in $ \mathbb{R^3}$?

I have coordinates of points that represent a curve (for example, helix or centerline of moebius strip) in $ \mathbb{R^3}$. I want to fit a Bspline through these points. How to do this in Mathematica? ...
3
votes
3answers
210 views

Linear fitting without intercept

I want to fit the following model: $y_t=\beta x_t+\epsilon_t$ For that, I've tried the following ...
1
vote
1answer
41 views

How to add constraints to “Fitting unknown number of Gaussians to data”?

This question of how to fit a sum Gaussians, where the number of Gaussians is to be determined, to data is answered nicely already by Fittting data with combination of an unknown number of Gaussians, ...
0
votes
0answers
34 views

A curve fitting by two Lorentz function

I am trying to fit my curve by two Lorentzian functions but i could not fit it properly, i found a lot of examples about Lorentzian fitting but none of this work with my data. Here is my code what i ...
0
votes
1answer
29 views

How to find the Maximal Absolute Error?

I found this fit but I do not understand how to find the maximal absolute error nor do I understand what it is really. I do not see what it is I would compare, would it be ...
0
votes
2answers
52 views

What are equations on mathematica and differences between these errors? [closed]

These are the three errors I was given. I so far wrote the code which was computing the polynomial interpolation but now I am asked to find those three norms: norm error mean norm error maximal ...
1
vote
2answers
72 views

How to fit different parts of a log-log plot

I have data of a function that goes like $f(x)\propto x ^\alpha $ for a certain range of $x$ and like $f(x)\propto x^\beta$ for another one. It is common in the literature to make a log log plot and ...
2
votes
1answer
51 views

How to plot a wave like curve by using existing data?

I am trying to draw a time vs. position graph with these data: t = {0, 0.47, 0.92, 1.37 ,1.8, 2.21} p = {0 ,11.3, 4.2, 10.5, 5, 9.5} But since the data does ...
0
votes
0answers
14 views

Apply Conditions on the Derivative of a Model with More Equations than Data in FindFit

Looking to combine the two approaches from these two posts here: How to Add a Constraint on the Derivative of the Model in FindFit How to fit 3 data sets to a model of 4 differential equations? ...
2
votes
1answer
43 views

How to Add a Constraint on the Derivative of the Model in FindFit

I would like to add constraints on a model and its derivatives and then use FindFit to fit some parameters. An example is below: ...
1
vote
1answer
29 views

FindFit or NMinimize? Fitting a System of ODEs to Long Time Behaviour

I am looking to fit a model composed of a system of ODEs to a long term behaviour given by a single data point of the final steady state of the system (e.g., x[1000] == pi/2). I have tried using both ...
7
votes
1answer
335 views

Finding a parametric curve fitting a two-dimensional dataset

I have a 2-dimensional data set where I want to find the function that fits best the points. My issue is that I am looking for a function of the for $f(x,y)=c$ with $c$ a constant. I could not find in ...
2
votes
1answer
71 views

Better curve fitting of sinusoids

I am trying to fit sinusoids to my experimental data of the form: $y= a+b sin(\theta)+csin(2\theta)+dsin(4\theta)$ and I am using the non-linear fit model. However I feel the data fitting is not good, ...
0
votes
1answer
32 views

How to fit a Weibull distribution function to histogram with unequal bins?

Whenever the function "FindDistributionParameter" is used in Wolfram Mathematica, it needs two inputs: raw data and distribution function. I have a problem where I have have data and I need to use ...
1
vote
1answer
73 views

Fitting with only few data points [closed]

I am trying to fit an upside down Cauchy distribution to very few data points which are seen in the picture below: I know that the minimum should be near x = 4, ...
1
vote
3answers
68 views

How to resolve Overflow error in FindFit method?

I am using FindFit function in order to fit my data and get two parameters: c and m. The function that I am using has the following form: ...
4
votes
2answers
71 views

Confused about LinearModelFit [closed]

I have two collections of noisy observations from a 2d quadratic function: collection $A$ is from $[0,1]^2$ collection $B$ is from $[1,2]^2$ When I try to fit the function to the data it works very ...
2
votes
1answer
54 views

Upper and lower bounds or points that do not align

I have data from similar function that are not evaluated on the same points. I would like to plot the points and the curves that are the upper and lower bounds of them. As an example consider the ...
1
vote
2answers
104 views

Linear fit statistics for a complex data set

I am having some technical and conceptual troubles in using NonlinearModelFit with a complex data set. I have a 2 dimensional array where the two positions are complex numbers, such that: ...
13
votes
4answers
2k views

Why does `FindFit` fail so badly in this simple case?

Consider ...
0
votes
0answers
40 views

What are the differences between Nonlinear ModelFit and GeneralizedLinearModelFit, and how to get MLE out of each?

I would like to know the practical differences and implications between NonlinearModelFit and GeneralizedLinearModelFit. As I ...
0
votes
2answers
55 views

Better fit for points with exaggerated deviations

I used the InterpolatingPolynomial function to get a polynomial that meets my points. But I noticed that there is a deviation in the final intervals. ...
0
votes
1answer
33 views
0
votes
0answers
35 views

How can I fit two out of phase data sets to an envelope?

My situation is similar to having a Cos and Sin functions that would combine to the profile of the envelope but the envelope is offset horizontally by some dt. It would be something like aCos(t+dt)+ ...
0
votes
1answer
62 views

NonlinearModelFit failing because varible range [closed]

I'm trying to fit a specific equation to a plot of points but its failing because the equation has a square root in it and I need to keep the values of x between a certain range. I know how to do this ...
1
vote
1answer
84 views

Parameter Estimation for Gaussian Function in Gaussian noise [closed]

Mathematical model can be given as follows. $$x[n]=a\exp[-(n - k)^2/s^2]+w[n]$$ Here w[n] is a zero mean Gaussian noise process with variance $3\cdot10^{-5}$. The problem is to estimate the ...
0
votes
1answer
50 views

How can I define the following function for arbitray values of the arguments?

Consider the following function a[m_, l_] = 1/Log[m/l]; with this function I define ...
0
votes
1answer
49 views

How is CurvatureConfidenceRegion in FittedModel from NonlinearModelFit calculated?

I have a FittedModel from NonlinearModelFit for which the determination of the ...
0
votes
1answer
55 views

goodness of fit test for grouped data

I have the following grouped data: Can someone please tell me how to run a goodness of fit test to test if this data is from a normal distribution? I would like to do this without estimating the ...
1
vote
2answers
72 views

fitting a monotonic function?

Let's say I have a few points and derivatives given for a function and I'd like to find the best fit through the data, which is monotonic. For example, if I take a polynomial ansatz, I get ...
1
vote
1answer
67 views

What is the most efficient way to use the fitted models?

I'm generating a simple linear model ($y=mx+b$) by fitting to the background of some data, and then trying to plug in the x-values of the data I'm actually interested in. I'm a bit surprised that <...
0
votes
0answers
99 views

Cannot fit data

First up, I'm quite new to Mathematica so any hints on better code would be greatly appreciated. I have already asked the question connected to this code, but later I've found a mistake. Now I need to ...
4
votes
2answers
105 views

Plotting perpendicular lines to a contour plot (electric field from equipotential curves)

I'm currently working on a experiment about Electric Fields and Equipotential Curves. The problem is that I want to plot (estimate) the curves of electric field using the fact that every one of these ...
0
votes
1answer
55 views

FindFit gives poor regression

My code is ...
1
vote
1answer
41 views

Output of the trained neural network for a set of inputs

Sorry if this was too trivial but I want to get the output of the neural network I trained for the specific inputs that I feed. The notation I often saw was of TrainedNet[inp] kind. But when I use ...
1
vote
0answers
41 views

What does the following error message mean, in the context of NonlinearModelFit?

I am deliberately not including data or a model for this question, as I want a more general answer so that I may be able to trouble shoot this myself in the future. When performing a fit, usually a ...
1
vote
1answer
64 views

Regression to fit data with an integral equation

I have a set data and I know that this data are best fitted by the following equation, assuming that f($\tau$) is a log normal distribution and $M_{eq}$ = 1.5: $M(t,\tau)= M_{eq} \int (1-e^{-t/\tau}) ...
5
votes
0answers
126 views

What are the most reliable test of goodness of fit in Mathematica

I realise this is possibly a VERY open ended question, and potentially has answers dotted around e.g. here . What are the most robust methods of testing the result of ...
3
votes
3answers
57 views

Fitting a function, a (x - 1)^b, to a given set of data

I have some data: ...