Manipulate Mathematica - Fitting Gaussian to Data

  • Context: Mathematica 
  • Thread starter Thread starter mr_hack
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary
SUMMARY

The discussion focuses on fitting a Gaussian function to data using Mathematica's Manipulate feature. The user initially attempted standard fitting methods like FindFit and NonlinearModelFit, which were unsuccessful. They successfully utilized Manipulate to visualize the Gaussian function by adjusting parameters sigma and c. A solution was provided to overlay the manipulated plot with the original data using the Show function within Manipulate.

PREREQUISITES
  • Familiarity with Mathematica programming language
  • Understanding of Gaussian functions and their parameters
  • Experience with data visualization techniques in Mathematica
  • Knowledge of ListPlot and Plot functions in Mathematica
NEXT STEPS
  • Learn how to use the Show function in Mathematica for combining plots
  • Explore advanced fitting techniques using NonlinearModelFit in Mathematica
  • Investigate data import methods in Mathematica for different file types
  • Study the Manipulate function in Mathematica for interactive visualizations
USEFUL FOR

Data scientists, researchers, and students working with data analysis and visualization in Mathematica, particularly those interested in statistical fitting techniques.

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
2K
  • · Replies 12 ·
Replies
12
Views
5K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K