Hello, I am a beginner user of Mathematica. I am using Mathematica to plot my ascii.csv file I have obtained through making measurement from a laser beam profiler. I am currently working on my capstone.
I am trying to figure out how to fit my .csv data to a two-dimensional Gaussian fit function. Currently my NonlinearModelFit is not working. Mathematica is giving me a list of errors. I have tried to search the internet, but I may not be searching the right topic since I can’t seem to figure out the problem.
One of the errors I am getting is “NonlinearModelFit::fitc: Number of coordinates (1928) is not equal to the number of variables (1).” or “NonlinearModelFit::fitc: Number of coordinates (1928) is not equal to the number of variables (2).”
The code I currently have is this:
data = Import[
"/Users/Isac/Desktop/CAPSTONE/Isac - NEW Capstone \
Measurements/Change in H/11mmH4mmV/40MHz_0001.ascii.csv", "Data"];
nlm = NonlinearModelFit[data,
A Exp[-(((x - x0)^2)/(2 \[Sigma]^2) + ((y -
y0)^2)/(2 \[Sigma]^2))], {{\[Sigma], 1928}, {x0, 50}, {y0,
50}, {A, 1}}, {x,y}]
Show[ListPlot[data, PlotStyle -> Red, PlotRange -> All],
Plot[nlm[x,y], {x, 0, 1928}, {y, 0 ,3500}, PlotRange -> All]]
I can’t seem to figure out what is wrong. Any help is appreciated!
P.S. Threw in the data.csv, hopefully this helps!
Very Respectfully,
Mr. Isac
**edit: The question has been answered. Thank you all who had helped me and guided me to better understanding in how to use Mathematica with the data that I had. My capstone professor is a busy person, and doesn’t have much time to help me. Not sure how I would have figure this out myself without the help from everyone here. Thank you all again.
40MHz_0001.ascii.csv (8.07 MB)



