Skip to main content
Re-tag
Link
Sektor
  • 3.3k
  • 7
  • 27
  • 36
Tweeted twitter.com/#!/StackMma/status/341647483631439872
added 14 characters in body
Source Link
Everett You
  • 2.3k
  • 1
  • 17
  • 19

I am wondering how to implement the multi-peak detecting and fitting in Mathematica. Following is an example of fitting the data using three peaks (such that the data ~ peak1 + peak2 + peak3).

Illustration of a multi-peak fitting

The peak model is given and fixed (all peaks are fitted by the same model), but its particular form (which will be input) can be Gaussian or Lorentzian or some other customized functions. The number of peaks is unknown and should be detected automatically, and the fitting model must also be built accordingly. Is there a Mathematica function that can simply do this? Or if anyone can give an idea of how to do the multi-peak fitting using Mathematica.

(I am aware of fitting functions like FindFit,NonlinearModelFit etc., so my question is more about how to build the model and estimate the initial parameters for input of the fitting functions.)


I am expecting something like this:

PeakFit[data_, pfun_, x_]:=...

where the data is a list of points like {{x1_,y1_}..}, x_ specifies the variable to be used, and the peak function pfun is a pure function whose first three parameters control the peak height, the peak width, and the central position, and the remaining (optional) parameters are for further control of the shape of the peak. For example a Gaussian model may be described as

pfun = Function[{x}, #1 Exp[-(x - #3)^2/(2 #2^2)]] &;

Given the data and the peak function, I wish PeakFit to return a FittedModel object containing the resulting model like pfun[A_,w_,xc_][x]+....

I am wondering how to implement the multi-peak fitting in Mathematica. Following is an example of fitting the data using three peaks (such that the data ~ peak1 + peak2 + peak3).

Illustration of a multi-peak fitting

The peak model is given and fixed (all peaks are fitted by the same model), but its particular form (which will be input) can be Gaussian or Lorentzian or some other customized functions. The number of peaks is unknown and should be detected automatically, and the fitting model must also be built accordingly. Is there a Mathematica function that can simply do this? Or if anyone can give an idea of how to do the multi-peak fitting using Mathematica.

(I am aware of fitting functions like FindFit,NonlinearModelFit etc., so my question is more about how to build the model and estimate the initial parameters for input of the fitting functions.)


I am expecting something like this:

PeakFit[data_, pfun_, x_]:=...

where the data is a list of points like {{x1_,y1_}..}, x_ specifies the variable to be used, and the peak function pfun is a pure function whose first three parameters control the peak height, the peak width, and the central position, and the remaining (optional) parameters are for further control of the shape of the peak. For example a Gaussian model may be described as

pfun = Function[{x}, #1 Exp[-(x - #3)^2/(2 #2^2)]] &;

Given the data and the peak function, I wish PeakFit to return a FittedModel object containing the resulting model like pfun[A_,w_,xc_][x]+....

I am wondering how to implement the multi-peak detecting and fitting in Mathematica. Following is an example of fitting the data using three peaks (such that the data ~ peak1 + peak2 + peak3).

Illustration of a multi-peak fitting

The peak model is given and fixed (all peaks are fitted by the same model), but its particular form (which will be input) can be Gaussian or Lorentzian or some other customized functions. The number of peaks is unknown and should be detected automatically, and the fitting model must also be built accordingly. Is there a Mathematica function that can simply do this? Or if anyone can give an idea of how to do the multi-peak fitting using Mathematica.

(I am aware of fitting functions like FindFit,NonlinearModelFit etc., so my question is more about how to build the model and estimate the initial parameters for input of the fitting functions.)


I am expecting something like this:

PeakFit[data_, pfun_, x_]:=...

where the data is a list of points like {{x1_,y1_}..}, x_ specifies the variable to be used, and the peak function pfun is a pure function whose first three parameters control the peak height, the peak width, and the central position, and the remaining (optional) parameters are for further control of the shape of the peak. For example a Gaussian model may be described as

pfun = Function[{x}, #1 Exp[-(x - #3)^2/(2 #2^2)]] &;

Given the data and the peak function, I wish PeakFit to return a FittedModel object containing the resulting model like pfun[A_,w_,xc_][x]+....

added 535 characters in body
Source Link
Everett You
  • 2.3k
  • 1
  • 17
  • 19

I am wondering how to implement the multi-peak fitting in Mathematica. Following is an example of fitting the data using three peaks (such that the data ~ peak1 + peak2 + peak3).

Illustration of a multi-peak fitting

The peak model is given and fixed (all peaks are fitted by the same model), but its particular form (which will be input) can be Gaussian or Lorentzian or some other customized functions. The number of peaks is unknown and should be detected automatically, and the fitting model must also be built accordingly. Is there a Mathematica function that can simply do this? Or if anyone can give an idea of how to do the multi-peak fitting using Mathematica.

(I am aware of fitting functions like FindFit,NonlinearModelFit etc., so my question is more about how to build the model and estimate the initial parameters for input of the fitting functions.)


I am expecting something like this:

PeakFit[data_, pfun_]pfun_, x_]:=...

where the datadata is a list of points like {{x_x1_,y_y1_}..}, x_ specifies the variable to be used, and the peak function pfun is a pure function whose first three parameters controllingcontrol the peak height, the peak width, and the central position, and the remaining (optional) parameters are for further control of the shape of the peak. For example ana Gaussian model may be described as

pfun = Function[{x}, #1 Exp[-(x - #3)^2/(2 #2^2)]] &;

Given the data and the peak function, I wish PeakFit willto return a FittedModel object containing the information of the fitting resultresulting model like pfun[A_,w_,xc_][x]+....

I am wondering how to implement the multi-peak fitting in Mathematica. Following is an example of fitting the data using three peaks (such that the data ~ peak1 + peak2 + peak3).

Illustration of a multi-peak fitting

The peak model is given and fixed (all peaks are fitted by the same model), but its particular form (which will be input) can be Gaussian or Lorentzian or some other customized functions. The number of peaks is unknown and should be detected automatically, and the fitting model must also be built accordingly. Is there a Mathematica function that can simply do this? Or if anyone can give an idea of how to do the multi-peak fitting using Mathematica.

(I am aware of fitting functions like FindFit,NonlinearModelFit etc., so my question is more about how to build the model and estimate the initial parameters for input of the fitting functions.)


I am expecting something like this:

PeakFit[data_, pfun_]:=...

where the data is a list of points like {{x_,y_}..} and the peak function pfun is a pure function whose first three parameters controlling the peak height, the peak width, and the central position, and the remaining (optional) parameters are for further control of the shape of the peak. For example an Gaussian model may be described as

pfun = Function[{x}, #1 Exp[-(x - #3)^2/(2 #2^2)]] &;

Given the data and the peak function, I wish PeakFit will return a FittedModel object containing the information of the fitting result.

I am wondering how to implement the multi-peak fitting in Mathematica. Following is an example of fitting the data using three peaks (such that the data ~ peak1 + peak2 + peak3).

Illustration of a multi-peak fitting

The peak model is given and fixed (all peaks are fitted by the same model), but its particular form (which will be input) can be Gaussian or Lorentzian or some other customized functions. The number of peaks is unknown and should be detected automatically, and the fitting model must also be built accordingly. Is there a Mathematica function that can simply do this? Or if anyone can give an idea of how to do the multi-peak fitting using Mathematica.

(I am aware of fitting functions like FindFit,NonlinearModelFit etc., so my question is more about how to build the model and estimate the initial parameters for input of the fitting functions.)


I am expecting something like this:

PeakFit[data_, pfun_, x_]:=...

where the data is a list of points like {{x1_,y1_}..}, x_ specifies the variable to be used, and the peak function pfun is a pure function whose first three parameters control the peak height, the peak width, and the central position, and the remaining (optional) parameters are for further control of the shape of the peak. For example a Gaussian model may be described as

pfun = Function[{x}, #1 Exp[-(x - #3)^2/(2 #2^2)]] &;

Given the data and the peak function, I wish PeakFit to return a FittedModel object containing the resulting model like pfun[A_,w_,xc_][x]+....

added 535 characters in body
Source Link
Everett You
  • 2.3k
  • 1
  • 17
  • 19
Loading
added 68 characters in body
Source Link
Everett You
  • 2.3k
  • 1
  • 17
  • 19
Loading
Source Link
Everett You
  • 2.3k
  • 1
  • 17
  • 19
Loading