# Questions tagged [fitting]

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

1,219 questions
Filter by
Sorted by
Tagged with
675 views

### PenaltyFunction Option in NMinimize

I am curious if anybody has some experience in using the built-in Option "PenaltyFunction" in any of the numerical optimization functions like NMinimize. According to the documentation the user ...
369 views

### How to derive SinglePredictionBands from a NonlinearModelFit model

I have found NonlinearModelFit to be extremely useful in my work. Here I have fit 4 points to a function and am being asked to explain how the 95% SinglePredictionBands associated with the plot below ...
187 views

### Simultaneous fitting to multiple data sets with multiple variables and some common parameters [duplicate]

I am trying to fit two data sets to a function model described below which share a few common parameters. Say I have two functions with some common parameter(s) ...
257 views

### Struggling with FindFit

I'm trying to fit a sinusoidal wave to some numerical data. I can do it by hand using manipulate, so I know roughly the sort of parameter values that I should get back, but functions such as FindFit ...
1k views

### 2D smoothing spline interpolation

Does Mathematica have 2D smoothing spline interpolation built in? I requires an interpolation method with smooth first derivatives and cubic bivariate splines fulfill this nicely. In python I would ...
7k views

### How can I obtain a smooth curve from my data but preserve two inversion points

I have a list of data points, {x, y}, my data. When I plot them, the curve is jagged. I want to smooth the curve and preserve the two sharp corners. This is a plot ...
3k views

### What is the difference between FindFit and NonlinearModelFit

I cannot get the difference between these two fitting functions in Mathematica. I even read in MMA that the result of these two are the same.
1k views

### Curve fit based on minimal data

Inspired by the fantastic answers here and here, I would like to ask a questions along similar lines. I have 6 curve types that follow these rules: Type A: If point 1 is positive and point 2 is ...
4k views

### Fitting ellipse to 5 given points on the plane

Five points are required to define a unique ellipse. An ellipse has five degrees of freedom: the $x$ and $y$ coordinates of each focus, and the sum of the distance from each focus to a point on the ...
579 views

### Saving data from NonlinearModelFit

If you use NonlinearModelFit the results are put into some sort of output package. How do you save these packages so that you can go back to them later? My particular problem is that I generating ...
301 views

### Comparing two ways of fitting systems of ODEs to data

I'd like to ask you if you see any difference between the two following ways of estimating parameters. Given my system of ordinary differential equations that I want to use to find the values of all ...
109 views

### Why does my Dynamic NonliearModelFit keep running?

I have complex data and which I am fitting to a complex formula. In order to use NonlinearModelFit I split the formula and the data into real and imaginary parts. ...
3k views

### Finding exponential model from data [duplicate]

I'm trying to find an exponential model from data for a homework problem. There is an accompanying video explaining how to do the bigger problem but it omits any instructions on the step where the ...
1k views

### General F statistic and p value in LinearModelFit

Many statistical packages provide a "F statistic" and the corresponding p value in their output of a multiple linear regression. I don't find that in the parameters of the Mathematica function ...
311 views

### Fitting composed model to experimental data

I have mathematical model based on equation: $y(x) = 1 - \sum_{b=1}^{\inf} 2c_b \sin(c_b x/L) \exp(ax)$ (1), where $c_b$ are the positive roots of equation: $c_b \cot c_b + aL = 0$ (2). $L$ is a ...
590 views

### Using Manipulate to dynamically correct the baseline of a signal

i have data with a baseline and will correct it with a polynomial fit using Manipulate to see immediatly the changes in the resulting spectrum. It works so far, but ...
827 views

### Fitting numerical model to experimental data

I have diffusion equation with the initial/boundary conditions: ...
396 views

### FindFit with parameters which are simultaneously in initial conditions

I have RLC circuit. I would like to find R and L by using FindFit, but L is in initial condition and I have problem with it. Could you help me ? ...
861 views

### Non-linear curve fitting with multiple parameters and conditional expression

The above integral(Bloch Gruneissen formula) is what i like to fit with my experimental data.I am new to Mathematica. To cross-check the fit results obtained in other software, I try to fit with my ...
682 views

### Formatting and inserting a parameter table into a plot

I'm fitting data, and I want to put the parameter table generated by NoninearModelFit into the plot. How can I do that in a reasonable way? I want to format the ...
588 views

### Removing Linear drift from an oscillating data

I have an array of 800,000 data measured at 1.1s time gap. It is oscillating data but has clear linear drift. I want to remove this linear drift. But the estimates by ...
276 views

### Cross-validation of a FittedModel

Although I would know how to perform cross-validation tests after fitting a model using a function like NonLinearModelFit, I wonder if there is a way to do this providing the right parameters to the ...
203 views

### Memory problem in Mathematica 10

I'm having a problem with memory. I'm doing nonliner fits of several data lists to a system of differential equations. When I evaluate the "Do" cycle the memory grows with the iteration step up to my ...
145 views

### How to fit data with numerical solution of system of parametric ODE? [duplicate]

I need to find the parameters (k1,k2,k3,k4,k1r,k2r,k3r,k4r) that fit my data (list of [Intensity, time]) using the function <...
94 views

### Can I use boolean parameters in LogitModelFit?

For example, to use 1 as True and 0 as False: ...
2k views

### Fit convoluted Gaussian and Lorentzian functions to a peak profile [duplicate]

I have a peak profile data like this: ...
1k views

### What is the natural way of using Dataset to get a FittedModel?

The new Dataset in Mathematica 10 is a great addition to the language, potentially reducing the convenience gap with R. Given this, I would like to understand what the equivalent simple or natural ...
782 views

### Developing easy code to apply Delta Method to generate prediction bands for custom distributions

I think that this is an interesting issue for all those who when to not only adjust one prediction function, but also to obtain the prediction bands to asses the graphical or tabular error I'm trying ...
325 views

### Zero-order interpolation not going fully around

Connected to this question, I want to do a zero-order interpolation of a bunch of datapoints which is periodic. The code I use is as follows: ...
234 views

### Confidence and prediction bands for custom nonlineal for CDF from ProbabilityDistribution

I have a CDF obtained with the code: ...
7k views

### How to use this Lorentzian function fit my data, I tried NonlinearModelFit, it always resulted with an error

The data is uploaded to Ideone http://ideone.com/ktIbVk , my code is : ...
207 views

### No real number fitting double exponential in Mathematica

I am trying to fit a double exponential curve to my data, but I got the error saying there are non real number. Also I tried with starting values for my 4 parameters, but this does not work either. ...
530 views

### Plot least squares curve on Linear Log Plot

I have the following Data: ...
294 views

### Why do EstimatedDistribution and DistributionFitTest work this way

I am fitting some time-series data to both a stable distribution and a normal distribution in order to assess the goodness of fit of each. Along the way I encountered the following confusing result. ...
1k views

### Fitting the Plot by fourier Series of either sine or cosine

I have list of data and its plot and I don't know how to fit the plot with fourier series of either sine or cosine. Full Data: ...
153 views

### What is the definition of FitResiduals

What is the definition of FitResiduals in Mathematica? I could not find its definition in the Mathematica help. Is it the same as chi squared?
1k views

### Logarithmic curve fit in data

I have the following data which are the theoretical: ...
2k views

### Does FindFit support complex numbers or doesn't it?

Inspired by this previous question: Findfit doesn't give the good fit; Changing the starting values will not change the results. Consider the following complex-valued dataset. ...
925 views

### Findfit doesn't give the good fit; Changing the starting values will not change the results

I have some complex data: ...
192 views

### Distance between data and curve

I have two datasets: ...
4k views

### Why does FindFit seem to have trouble fitting exponential data?

I have 4 data points. t is in minutes, and y is radioactive counts per minute. When I input the following lines: ...
384 views

### Problems extending NelderMeadMinimize into 2D

Update The eventual route I followed was to adapt a version of the NM-simplex written in C and link to it with MathLink. Once I've tested this out fully I'll post it here. I've been playing around ...
3k views

### Fitting data to a Poisson distribution

I'm trying to fit a Poisson Distribution to data produced in a lab. I've successfully made a Histogram of the data, which looks like: However, when I try to fit the Poisson Distribution using: <...
280 views

### Piecewise conditions with a parametric PDE

I'm using ParametricNDsolve to check best fit of a model (function Eb1) with some data, and I have four free parameters I want to test. I can easily construct a Parametric solution between the two ...
178 views

### FindFit is producing a list of imaginary numbers when there is non

I am trying to find the fit of an equation to some data and mathematica thinks there is a list of imaginary values. My data is all real positive number. ...
107 views

### Horizontal shift in fitting data by a sinusoidal nonlinear model [duplicate]

I have data that can apparently be fitted by a sinusoidal function in form $D+A\sin(B(x-\frac CB))$. I tried doing the best fit in Mathematica using ...
4k views

### Error function fit of data

I have this experimental data set which I know should follow the Complementary error function. My goal is to find the σ of the associated gaussian distribution. However, I cannot seem to do it in ...
293 views

### To obtain an equation for a given curve

I have obtained the graph, I would like to know its equation. The graph seems to be a hyperbolic spiral which, its equation reads, $r = a/\theta$. I read here and also, but these are concerning the ...