Manipulate Mathematica - Fitting Gaussian to Data

  • Mathematica
  • Thread starter mr_hack
  • Start date
  • Tags
    Mathematica
In summary, the conversation discusses using Mathematica to manipulate data and fit it with a Gaussian function. The use of Manipulate is suggested to find the appropriate function and the possibility of plotting the data and the manipulated plot in the same figure is also discussed. It is mentioned that the variable c and sigma can be used from the Manipulate result by using Show[Plot[...],ListPlot[...]] in the code.
  • #1
mr_hack
3
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
  • #2


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

1. What is Mathematica?

Mathematica is a software program used for mathematical and statistical calculations, data analysis, and visualization. It is commonly used by scientists, engineers, and mathematicians for complex calculations and modeling.

2. How do I fit a Gaussian curve to my data in Mathematica?

To fit a Gaussian curve to your data in Mathematica, you can use the built-in function FindFit. This function takes in your data and a model function, such as GaussianDistribution, and finds the best parameters to fit the curve to your data.

3. Can I customize the parameters of the Gaussian curve in Mathematica?

Yes, you can customize the parameters of the Gaussian curve by using the FindFit function with a custom model function. You can also use the NonlinearModelFit function for more advanced customization options.

4. How do I plot the fitted Gaussian curve with my data in Mathematica?

To plot the fitted Gaussian curve with your data, you can use the Show function to display both the original data and the fitted curve on the same plot. You can also use the Plot function to plot the fitted curve separately.

5. Can I export the fitted Gaussian curve and my data from Mathematica?

Yes, you can export the fitted Gaussian curve and your data from Mathematica in various formats, such as CSV or Excel. You can use the Export function to save your data and curve as a file that can be opened in other programs for further analysis or visualization.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
884
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
4K
  • Atomic and Condensed Matter
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top