Questions tagged [fitting]

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

Filter by
Sorted by
Tagged with
1 vote
2 answers
129 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
  • 317
3 votes
3 answers
304 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
  • 317
0 votes
0 answers
53 views

When should you use FindFit vs NonlinearModelFit for logistic model fit? [closed]

Is NonlinearModelFit only suitable for fitting normally-distributed output data and FindFit is for any kind of general model fitting? I'm just learning mathematica and thought I would try fit a ...
huntse's user avatar
  • 1
0 votes
0 answers
64 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
48 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
113 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
75 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
0 votes
1 answer
61 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
  • 317
5 votes
2 answers
220 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
  • 317
2 votes
1 answer
139 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
207 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
65 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
101 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
96 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
  • 317
5 votes
0 answers
135 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,263
2 votes
1 answer
100 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
  • 345
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
59 views

Normal Distribution of random plot

I have the following data, ...
a019's user avatar
  • 845
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
200 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,250
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
283 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
342 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
136 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
139 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
458 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
199 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
422 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
250 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,541
2 votes
2 answers
188 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
95 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
391 views

How to fit function with data?

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

How to optimize ODE parameter fitting?

Consider the data ...
sam wolfe's user avatar
  • 4,541
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,541
1 vote
2 answers
123 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
52 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
39 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
130 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 vote
0 answers
84 views

How to compare simulated and experimental data?

I have numerically simulated and experimental data, I want to compare them and find the variation against numerical data. I do not have any idea about it. I just plotted experimental and simulated ...
Gopal Verma's user avatar
  • 1,055
1 vote
2 answers
161 views

Fitting a function to the data

I have a set of data, how can I fit the best function to that? i use FindFit and then I guess the function myself, but I want Mathematica to find the best fit. How can it be done? ...
lia's user avatar
  • 307
1 vote
1 answer
92 views

Simultaneous NonlinearModelFit for two data sets that are separate functions of x and t [duplicate]

I am trying to simultaneously fit two data sets that are separate functions of $x$ and $t$ with NonlinearModelFit. Here is an example of the data: ...
sje1g13's user avatar
  • 45
0 votes
0 answers
67 views

Improving the curve of a quadratic spline interpolation

I have these data and I want to make a curve using quadratic spline interpolation. I am successful in computing the equations and plotting the curves. However, I noticed that the peaks of the curves ...
Mule's user avatar
  • 43
1 vote
2 answers
75 views

Fitting linear decay to a semilogarithmic line

I am trying to fit this set of data,I tried a simple linear model but it didn't yield successful results, I also tried curve_fit on Python but also no luck - here ...
atomic-muclei's user avatar
1 vote
2 answers
172 views

How to fit a data a long 3D path?

I have two data sets in the form dat1={{x,y,z}, f1[x,y,z]} and dat2={{x,y,z}, f2[x,y,z]} I want to fit a model with common ...
MMA13's user avatar
  • 4,534
8 votes
6 answers
1k views

How can I fit a parabola to 2D data points?

I am looking for good Mathematica code to fit a parabola to 2D data, such as this: ...
Ted Ersek's user avatar
  • 909
1 vote
1 answer
123 views

Nonlinear experimental data fit without initial parameters

I am trying to fit correlation data into a non-linear model but it is not working. My data plot looks like this: The equation I am using for fit is The Mathematica script i am using looks like: <...
SKR's user avatar
  • 11
6 votes
3 answers
439 views

Best exponential fit for guitar frets [closed]

I have an old guitar that has missing the nut (zeroth fret) and also missing the bridge. I want to figure out their position. So I measured distances between first fret and frets ...
azerbajdzan's user avatar
  • 13.4k
1 vote
2 answers
68 views

Why it doesn't plot my fit? (And which function would you suggest to match this data?)

Could you let me know why it doesn't plot the fit? Which function would you recommend to use to match well this data? Thanks for your help. ...
Chris_toph's user avatar

1
2 3 4 5
35