Mathematica Manipulate Mathematica - Fitting Gaussian to Data

  • Thread starter Thread starter mr_hack
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary
To fit a Gaussian function to imported data in Mathematica, the user initially struggled with standard fitting methods and opted for a Manipulate function to visualize the Gaussian plot interactively. The user sought advice on combining the manipulated Gaussian plot with the original data plot in a single figure. The solution provided suggests using the Show function within Manipulate to overlay the Gaussian plot on the ListPlot of the data. This approach allows for simultaneous visualization of the data and the manipulated Gaussian parameters, enhancing the analysis of the fit.
mr_hack
Messages
3
Reaction score
0
Manipulate Mathematica!

Hey guys

I have a data imported as List, i plotted this data as ListPlot, i need to fit this function with gaussian, the standard fit or find fit or nonlinearmodelfit didn't work, so i used Manipulate as : Manipulate[
Plot[1/(sigma Sqrt[2 \[Pi]]) E^(-(x - c)^2/(2 sigma^2)) , {x, 0.004,
0.00415}], {sigma, 0.00001, 0.00015}, {c, 0.004, 0.00415}]
to see what function suits me..
My questions: is there a way to plot my data and my maniplated plot in the same figure??
if not is there a way to use the result of Manipulate i mean the variable c, sigma when i change them with manipulate.
MyProgram:
B = Import[
"C:\\Documents and Settings\\kmallat\\Desktop\\profil et \
snr\\image00.xls"]
gj = ListPlot
gy = Manipulate[
Plot[1/(sigma Sqrt[2 \[Pi]]) E^(-(x - c)^2/(2 sigma^2)) , {x, 0.004,
0.00415}], {sigma, 0.00001, 0.00015}, {c, 0.004, 0.00415}]
 
Physics news on Phys.org


Just use Show[Plot[...],ListPlot[...]] inside your Manipulate.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 12 ·
Replies
12
Views
5K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
10K