Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

Your provided data is very noisy. You can get more information from it if you filter it first. I will apply a LowpassFilter and a logarithmic transform on the $y$ values, and scale down the $x$ values. This usually helps the fitting algorithm.

datat = Transpose[{#[[All, 1]]/1500, 
     Log10[LowpassFilter[#[[All, 2]], .1]]} &@data];
ListPlot[datat, PlotRange -> All, Joined -> True]

Mathematica graphics

Now, you can perform the multi-peak fitting process from the linked discussionlinked discussion.

It's up to you to decide which peaks are signal and which are artifacts. I am providing here the solution with 4 peaks.

With[{n = 4}, 
 resfunc = 
  peakfunc[A[#], μ[#], σ[#], x] & /@ Range[n] /. 
   model[datat, n][[2]]]
(* copied from @Silvia's answer with slight modifications *)
Show@{Plot[Evaluate[resfunc], {x, -5, 10}, 
   PlotStyle -> ({Directive[Dashed, Thick, 
         ColorData["DarkRainbow"][#]]} & /@ 
      Rescale[Range[Length[resfunc]]]), PlotRange -> All, 
   Frame -> True, Axes -> False, ImageSize -> 700], 
  Plot[Evaluate[Total@resfunc], {x, -5, 10}, 
   PlotStyle -> Directive[Thick, Red, Opacity[.5]], PlotRange -> All, 
   Frame -> True, Axes -> False], 
  Graphics[{PointSize[.003], Gray, Line@datat}]}

4-peak fitting result

You will of course have to scale the fitted functions back to the original data, but this should be trivial.

Your provided data is very noisy. You can get more information from it if you filter it first. I will apply a LowpassFilter and a logarithmic transform on the $y$ values, and scale down the $x$ values. This usually helps the fitting algorithm.

datat = Transpose[{#[[All, 1]]/1500, 
     Log10[LowpassFilter[#[[All, 2]], .1]]} &@data];
ListPlot[datat, PlotRange -> All, Joined -> True]

Mathematica graphics

Now, you can perform the multi-peak fitting process from the linked discussion.

It's up to you to decide which peaks are signal and which are artifacts. I am providing here the solution with 4 peaks.

With[{n = 4}, 
 resfunc = 
  peakfunc[A[#], μ[#], σ[#], x] & /@ Range[n] /. 
   model[datat, n][[2]]]
(* copied from @Silvia's answer with slight modifications *)
Show@{Plot[Evaluate[resfunc], {x, -5, 10}, 
   PlotStyle -> ({Directive[Dashed, Thick, 
         ColorData["DarkRainbow"][#]]} & /@ 
      Rescale[Range[Length[resfunc]]]), PlotRange -> All, 
   Frame -> True, Axes -> False, ImageSize -> 700], 
  Plot[Evaluate[Total@resfunc], {x, -5, 10}, 
   PlotStyle -> Directive[Thick, Red, Opacity[.5]], PlotRange -> All, 
   Frame -> True, Axes -> False], 
  Graphics[{PointSize[.003], Gray, Line@datat}]}

4-peak fitting result

You will of course have to scale the fitted functions back to the original data, but this should be trivial.

Your provided data is very noisy. You can get more information from it if you filter it first. I will apply a LowpassFilter and a logarithmic transform on the $y$ values, and scale down the $x$ values. This usually helps the fitting algorithm.

datat = Transpose[{#[[All, 1]]/1500, 
     Log10[LowpassFilter[#[[All, 2]], .1]]} &@data];
ListPlot[datat, PlotRange -> All, Joined -> True]

Mathematica graphics

Now, you can perform the multi-peak fitting process from the linked discussion.

It's up to you to decide which peaks are signal and which are artifacts. I am providing here the solution with 4 peaks.

With[{n = 4}, 
 resfunc = 
  peakfunc[A[#], μ[#], σ[#], x] & /@ Range[n] /. 
   model[datat, n][[2]]]
(* copied from @Silvia's answer with slight modifications *)
Show@{Plot[Evaluate[resfunc], {x, -5, 10}, 
   PlotStyle -> ({Directive[Dashed, Thick, 
         ColorData["DarkRainbow"][#]]} & /@ 
      Rescale[Range[Length[resfunc]]]), PlotRange -> All, 
   Frame -> True, Axes -> False, ImageSize -> 700], 
  Plot[Evaluate[Total@resfunc], {x, -5, 10}, 
   PlotStyle -> Directive[Thick, Red, Opacity[.5]], PlotRange -> All, 
   Frame -> True, Axes -> False], 
  Graphics[{PointSize[.003], Gray, Line@datat}]}

4-peak fitting result

You will of course have to scale the fitted functions back to the original data, but this should be trivial.

Source Link
shrx
  • 7.8k
  • 2
  • 23
  • 57

Your provided data is very noisy. You can get more information from it if you filter it first. I will apply a LowpassFilter and a logarithmic transform on the $y$ values, and scale down the $x$ values. This usually helps the fitting algorithm.

datat = Transpose[{#[[All, 1]]/1500, 
     Log10[LowpassFilter[#[[All, 2]], .1]]} &@data];
ListPlot[datat, PlotRange -> All, Joined -> True]

Mathematica graphics

Now, you can perform the multi-peak fitting process from the linked discussion.

It's up to you to decide which peaks are signal and which are artifacts. I am providing here the solution with 4 peaks.

With[{n = 4}, 
 resfunc = 
  peakfunc[A[#], μ[#], σ[#], x] & /@ Range[n] /. 
   model[datat, n][[2]]]
(* copied from @Silvia's answer with slight modifications *)
Show@{Plot[Evaluate[resfunc], {x, -5, 10}, 
   PlotStyle -> ({Directive[Dashed, Thick, 
         ColorData["DarkRainbow"][#]]} & /@ 
      Rescale[Range[Length[resfunc]]]), PlotRange -> All, 
   Frame -> True, Axes -> False, ImageSize -> 700], 
  Plot[Evaluate[Total@resfunc], {x, -5, 10}, 
   PlotStyle -> Directive[Thick, Red, Opacity[.5]], PlotRange -> All, 
   Frame -> True, Axes -> False], 
  Graphics[{PointSize[.003], Gray, Line@datat}]}

4-peak fitting result

You will of course have to scale the fitted functions back to the original data, but this should be trivial.