summaryrefslogtreecommitdiff
path: root/fitGaussian1D.m
diff options
context:
space:
mode:
authorMi Zhang <mzhang@email.wm.edu>2012-09-11 16:03:41 -0400
committerMi Zhang <mzhang@email.wm.edu>2012-09-11 16:03:41 -0400
commitd1d7a486cc70665dafe64aaddd44c58e228815b0 (patch)
treeacbf530230d6860c9a85f5f1d67d0e445dde5192 /fitGaussian1D.m
downloadbeam_profiler-d1d7a486cc70665dafe64aaddd44c58e228815b0.tar.gz
beam_profiler-d1d7a486cc70665dafe64aaddd44c58e228815b0.zip
initial commit
Diffstat (limited to 'fitGaussian1D.m')
-rw-r--r--fitGaussian1D.m11
1 files changed, 11 insertions, 0 deletions
diff --git a/fitGaussian1D.m b/fitGaussian1D.m
new file mode 100644
index 0000000..b3fbb56
--- /dev/null
+++ b/fitGaussian1D.m
@@ -0,0 +1,11 @@
+function [z] = fitGaussian1D(p,v,x)
+
+cx = p(1);
+wx = p(2);
+amp = p(3);
+background = p(4);
+
+zx = amp*exp(-2*(x-cx).^2./(wx^2)) - v - background;
+
+
+z = sum(zx.^2);