Skip to main content

Questions tagged [fitting]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
32 views

Using NonlinearModelFit for fitting equation with two variables and 6 or more Parameters

I have some set of values, which I need to fit into an equation of the form $$y=(A1*e^{(-A2*x1^2)}*e^{(-A3*x2^2)}) + (B1*e^{(-B2*x1^2)}*e^{(-B3*x2^2)})+...+(F1*e^{(-F2*x1^2)}*e^{(-F3*x2^2)})$$ ...
sreeraj t's user avatar
  • 303
1 vote
1 answer
61 views

Fitting with Step Function (Beginner question) [duplicate]

I have data as below. ...
rani's user avatar
  • 321
0 votes
2 answers
106 views

NonlinearModelFit extremely slow performance with a single iteration

I have been experiencing very slow performance of NonlinearModelFit. The code that in my case causes that is below. The first part gets the data, the model and ...
atapaka's user avatar
  • 3,954
0 votes
1 answer
43 views

Using NonlinearModelFit output in multiple Plot instances within DynamicModule

I'm creating a script for interactive model fitting where the user selects a 'window' of the data to exclude from the fitting. I can come up with a MWE like the following: ...
BoseEinsteinCondensator's user avatar
5 votes
1 answer
209 views

P-Values For LinearModelFit Changing Due To Ordering Of Features

The arbitrary ordering in a linear model of the independent variables should not impact the p-values for the coefficients of said model. However that is exactly what is happening here ...
Daniel Berkowitz's user avatar
6 votes
1 answer
403 views

Finding an ellipse of minimum area that encloses a set of points

Is there a built-in function or set of functions in Mathematica that can take a set of points in the x-y plane and determine the ellipse of minimum area that contains all of the points? I am sure ...
BioPhysicist's user avatar
  • 1,124
0 votes
0 answers
102 views

Fitting problem for sigmoid like experimental data

I have data like this ...
rani's user avatar
  • 321
6 votes
1 answer
188 views

Curve fitting with Mathematica

I am trying to find de parametric equations of this curve (the curve in that sector of circle): What I've tried: ...
MathLearner's user avatar
-1 votes
1 answer
145 views

Help needed with the fitting and bug

...
random's user avatar
  • 9
3 votes
2 answers
104 views

FindFit or NonlinearModelfit for sinusoidal function

I am trying to fit this data set into a specific sinusoidal equation. The equation is shown like this. ...
JS LEE's user avatar
  • 31
5 votes
4 answers
540 views

Dealing with derivative of noisy experimental data

I have the following (time, position) dataset ...
MOOSE's user avatar
  • 169
1 vote
2 answers
151 views

The best way to guess the needed data using Mathematica?

I have a question, which is not entirely related to Mathematica, and would appreciate any help on this matter. I have the following dataset, which shows the growth of a bacterium in a specific medium: ...
A novice's user avatar
  • 405
3 votes
3 answers
315 views

Why does this simple fit run forever?

The following fit runs forever on my laptop; how to speed up? ...
A novice's user avatar
  • 405
0 votes
1 answer
86 views

Solve constraints don't work properly

So in my previous question, I was trying to find two parameters kV and km for an implicit function using FindFit(FF) command and I did it but the problem is that it takes around an hour to do it. ...
Karen Simonyan's user avatar
1 vote
0 answers
52 views

My sinusoidal fit requires an unused extra constant to work

I am trying to fit a sinusoidal curve onto the following data: ...
Zeke Coady's user avatar
2 votes
2 answers
119 views

Problem related to fitting a damped sine function

When I try to fit an exponential damped sine, it acts as if it cannot reach the amplitude at all. What do I change? link to data: datafile Getting data: ...
hubvoy's user avatar
  • 21
1 vote
2 answers
85 views

How do I fit unknown function to my data?

I have a set of data, to which I am trying to fit an unknown function. I believe it might be a logarithmic function, but I am not sure. Can you help me find a working model? ...
DarnokPL's user avatar
0 votes
0 answers
78 views

How can I approximate a function with composite polynomials?

I know that to approximate a function with for example $f(x) = \sin(x)$ using polynomials with degrees up to 4, I can use the Fit function : ...
何子钦's user avatar
1 vote
1 answer
72 views

How to include Manipulate in fitting?

I'm trying to fit three differential equations to two data sets, using the code developed by @Cesareo, as follows: ...
A novice's user avatar
  • 405
5 votes
2 answers
228 views

How can I use option Weights for fitting?

I have the following dataset (time vs. a quantity called $s$): OPD = {{0, 0.0305}, {3, 0.14}, {6, 0.5}, {17, 4.02}, {19, 5.04}, {21, 5.52}, {24, 5.76}}; To the ...
A novice's user avatar
  • 405
2 votes
1 answer
155 views

How can I fit rational function to data?

I have a dataset written below. I need to find a rational function that best fits this data set. How can I do it using Mathematica? The answer should be: $$f(t)=(2.196t^5+2.27t^4+2.013t^3+0.9592t^2+0....
Pabitra Tripathy's user avatar
2 votes
2 answers
213 views

Find function by solving equations and imposing constraints

Suppose there are two equations: $$2f(x)+x^2g(x)=8 \tag{1},$$ $$ x^3f(x)+6g(x)=18 \tag{2}.$$ I need to solve these two equations and find the functions $f(x)$ and $g(x)$ in terms of $x$ and constants. ...
Pabitra Tripathy's user avatar
0 votes
1 answer
69 views

Fitting Chebyshev to 2D data

I have complex data points on a 2D square (say $[0,10]^2$). I tried the following example function: $xye^{i(x+y)}$. I split up the Re and ...
Confuse-ray30's user avatar
1 vote
1 answer
103 views

Fit a point that defines a 90° angle

I'm trying to come up with a fit that will give me x,y coordinates of a point, that best fit in 2 slopes, the 2 slopes intercepting at 90°. At the moment I fit individually 2 lines to a 2 sets of ...
A postdoc's user avatar
  • 159
3 votes
1 answer
100 views

Fitting a first-order ODE

I want to fit the following equation $\dot{B} ( t ) = \kappa ( 1 - B ( t ) ),$ to the dataset: $\{ ( 1.17, 0.27 ), ( 2, 0.5 ), ( 4, 0.73 ), ( 6, 0.93 ), ( 8, 1 ), ( 10, 0.93 ), ( 20, 0.8 ) \}$, where ...
A novice's user avatar
  • 405
5 votes
0 answers
139 views

What is resistivity function of a 3-bar electric switch?

I answered a question on Physics StackExchange - considered as homework - numerically. The question is: What is the resistance of three stacked identical blocks, the middle bar shifted by its half ...
Roland F's user avatar
  • 3,637
2 votes
1 answer
105 views

How to setup FindFit function so that fitted function fits nicely to data points?

I am trying to fit some data points to a transformed natural log function and transformed 1/x function. However, the fitted 1/x function fails to adhere nicely to the data points when x is growing ...
Johnson's user avatar
  • 357
0 votes
1 answer
52 views

Trouble using Integrate as the model in NonlinearModelFit

I'm trying to fit a set of heat capacity data to the Debye model. This is the sample dataset that I'm using: ...
YohanChad's user avatar
0 votes
1 answer
62 views

Normal Distribution of random plot

I have the following data, ...
a019's user avatar
  • 867
0 votes
0 answers
52 views

I need help with plotting and SVEIAR Code with the Reproduction Number on Mathematica

I need help because everytime I plot it doesn't work. ...
izayafiji's user avatar
3 votes
2 answers
204 views

Meaning of arguments in FittedModels`ParameterEllipsoid

I am trying to figure out what FittedModels`ParameterEllipsoid's parameters mean (I want to construct a filled ellipse) Here is a minimum working example: ...
Craig Carter's user avatar
  • 4,425
0 votes
0 answers
35 views

Use Fitting Parameter from Solve or Nminimize with LinearModelFit

Im Trying to minimize a function by varying parameter "a" with Solve or Nminimize. The Problem is that "a" is dependent on my parameter "R" which is dependent on "a&...
HerbertderGe's user avatar
4 votes
2 answers
285 views

How fit my data to sinus?

I have problem with fit sinus to my date, because this sin is very tiny. This is my code: ...
DarnokPL's user avatar
1 vote
1 answer
343 views

Fitting delay differential equations (DDE)

I have the following differential equations: $$S'(t) = 0.31 S(t) \Big( 1 - \frac{S(t)}{6.19} \Big)- \frac{a}{1 + B(t)} S(t),$$ $$B'(t) = c (1 - B(t)) - d B(t) S(t) - 3 c (1 - B(t - 18)),$$ where $B(t -...
user avatar
0 votes
2 answers
141 views

Chi-square minimization error

I'm trying to fit some data into a model using the standard procedure of minimizing the chi-square function using this code: ...
Syn1110's user avatar
  • 51
1 vote
1 answer
151 views

Why does using a sparse matrix for least squares instead slow down the speed?

Here is the code. The matrix appears to be relatively sparse in terms of its visual representation, but why does using least squares result in significantly slower speed compared to the previously ...
Yilin Cheng's user avatar
1 vote
0 answers
460 views

How to include impulses in differential equations?

I have two coupled differential equations as follows: $$S'(t) = - \frac{a}{1 + B(t)} S(t),$$ $$B'(t) = \frac{c}{1 + S(t)} B(t) (1 - B(t)) - d B^2(t) \Big( \frac{1 - B(t)}{B(t)} \Big)^n,$$ where $a$, $...
user avatar
0 votes
1 answer
200 views

Using ParametricNDSolveValue and MultiNonlinearModelFit to fit an ODE system to datasets

I asked a question here about fitting an ODE system to given datasets. The great answer of @ydd solved the problem nicely. In the mentioned answer, the initial values are taken as the initial points ...
user avatar
4 votes
2 answers
425 views

Modeling experimental data with differential equations

I have the following two sets of experimental data, which show the dependencies of two quantities, namely, $S$ and $B$, on time ($0$ h, $3$ h, $6$ h, $9$ h, $15$ h, $18$ h, $21$ h, and $24$ h): ...
user avatar
3 votes
2 answers
252 views

Optimizing an ODE fitting algorithm with interpolated data

Given data, I want to find parameters $p_1,p_2,k_1,k_2>0$ that fit the following ODE system $$ \begin{align} b'(t)&=p_1 a(t)-k_1b(t)\\ c'(t)&=p_2b(t)-k_2c(t) \end{align} $$ where $a(t)$ is ...
sam wolfe's user avatar
  • 4,693
2 votes
2 answers
194 views

Fitting Hill function to a given dataset

I have the following data: data = {{15, 1}, {18, 1470.7`/1476.9333333333334`}, {21, 1326.2333333333333`/1476.9333333333334`}, {24, 316.8`/1476.9333333333334`}}; ...
user avatar
1 vote
1 answer
96 views

Obtaining the growth rate of bacteria using NonlinearModelFit

I have a data set concerning the growth of bacteria, and I need to obtain the so-called growth rate. My data set is (OD600 vs. time(h)): ...
user avatar
4 votes
3 answers
402 views

How to fit function with data?

I have ...
Sale Gauss's user avatar
3 votes
1 answer
122 views

How to optimize ODE parameter fitting?

Consider the data ...
sam wolfe's user avatar
  • 4,693
1 vote
1 answer
56 views

How to fit a linear ODE system?

Consider the equations $$ \begin{align} b'(t)=p_1 c(t)-k_1b(t),\\ c'(t)=p_2b(t)-k_2c(t) \end{align} $$ Given data on $b$ and $c$, and initial conditions, how do I find the best fitting parameters $k_1,...
sam wolfe's user avatar
  • 4,693
1 vote
2 answers
125 views

Could a minimization problem be easily converted into a NonlinearModelFit?

I am trying to fit data that is correlated, such that the $\chi^2 = (f(x_i,pars)-y_i)(Cov^{-1})_{ij}(f(x_j,pars)-y_j)$. However, NonlinearModelFit only accepts ...
pablo's user avatar
  • 723
2 votes
0 answers
57 views

NonlinearModelFit of data with errors

Experimental data points invariably come with errors. These errors can significantly influence the parameters and their uncertainties when performing non-linear fitting. However, NonlinearModelFit ...
Филипп Цветков's user avatar
0 votes
0 answers
40 views

NonlinearModelFit with NMinimize Submethods and Selective or Mixed-Head Constraints

Problem: I believe I've found a two related bugs associated with using NonlinearModelFit while making a Method call to NMinimize's submethods, e.g. "RandomSearch" and "...
Ghersic's user avatar
  • 1,147
0 votes
2 answers
140 views

Fitting data with ${\rm sinc}^2(x)$

I performed an experiment of Fraunhofer diffraction with slits, the results of which should be proportional to $\operatorname{sinc}^2(x) = \left(\frac{\sin x}{x}\right)^2$. However, an error occurred ...
L0wc3ll's user avatar
1 vote
0 answers
54 views

Fitting experimental data to a plot with different x-axis paths

Given Mathematica code of eigenvalues in different variable-paths , I want to add experimental data in the path Gamma-X ; X-Gamma ; and M-Gamma . Here is the code : ...
Med Ch's user avatar
  • 117

1
2 3 4 5
35