All Questions
Tagged with linearmodelfit or fitting
1,768 questions
1
vote
2
answers
100
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?
...
0
votes
0
answers
87
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 :
...
1
vote
1
answer
74
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:
...
5
votes
2
answers
250
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 ...
3
votes
1
answer
215
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....
2
votes
2
answers
220
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. ...
0
votes
1
answer
76
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 ...
1
vote
1
answer
105
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 ...
3
votes
1
answer
107
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 ...
5
votes
0
answers
144
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 ...
2
votes
1
answer
109
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 ...
0
votes
1
answer
53
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:
...
0
votes
1
answer
76
views
Normal Distribution of random plot
I have the following data,
...
0
votes
0
answers
54
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.
...
3
votes
2
answers
210
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:
...
0
votes
0
answers
39
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&...
4
votes
2
answers
289
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:
...
1
vote
1
answer
359
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 -...
0
votes
2
answers
161
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:
...
1
vote
1
answer
208
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 ...
1
vote
0
answers
472
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$, $...
0
votes
1
answer
214
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 ...
4
votes
2
answers
447
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):
...
3
votes
2
answers
258
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 ...
2
votes
2
answers
211
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`}};
...
1
vote
1
answer
99
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)):
...
4
votes
3
answers
442
views
How to fit function with data?
I have
...
3
votes
1
answer
133
views
How to optimize ODE parameter fitting?
Consider the data
...
1
vote
1
answer
60
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,...
1
vote
2
answers
128
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 ...
2
votes
0
answers
131
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 ...
0
votes
2
answers
171
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 ...
1
vote
0
answers
58
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 :
...
1
vote
0
answers
124
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 ...
1
vote
2
answers
172
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?
...
1
vote
1
answer
104
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:
...
0
votes
0
answers
94
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 ...
1
vote
2
answers
80
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 ...
1
vote
2
answers
178
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 ...
9
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:
...
1
vote
1
answer
140
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:
<...
6
votes
3
answers
459
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 ...
1
vote
2
answers
71
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.
...
4
votes
6
answers
328
views
How can I fit a set of points to the form $y = a(b-x)^c$?
I have a list of points $(x, y)$, and I expect them to be related as $$y = a(b-x)^c,$$ where $a$, $b$, and $c$ are unknown constants. I also know the approximate values of constants, which can be used ...
2
votes
2
answers
759
views
Fitting a power law on linear and log scale
I am fitting a power law $Y = aX^b$ to a data set. There are two ways to do this:
One is on log-scale, which means fitting $\log(Y)$ to $a_1 + b_1\log(X)$.
In other case, using linear scale to fit $Y ...
7
votes
5
answers
684
views
How to fit an ellipse to 2D data points?
All code in the question is a slight modification of code here.
First I use a method george2079 used to make random points near an ellipse.
...
0
votes
1
answer
77
views
Interpolation error to generate a two variable function
I am facing some issues with performing an interpolation. From the image, you can find the values in three columns, the 1st column is x, the second column is ...
1
vote
3
answers
168
views
Fitting C-shaped points with right-pointing parabola, ellipse, circle or other
I was trying to fit the following points:
...
0
votes
0
answers
65
views
How to use NetChain to obtain a fit that is at least accurate on the training data
How do I use NetChain to obtain a fit that is at least accurate on the training data?
I am trying to get a hopefully predictive fit for some data (see my question ...
3
votes
1
answer
163
views
Combining multiple peak fits to one
I'd like to combine three separate fits to one. As you can see in the picture below, there's an underground I manually fitted with the function
...