summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Gaussian2D.m6
1 files changed, 4 insertions, 2 deletions
diff --git a/Gaussian2D.m b/Gaussian2D.m
index 7063b06..db111b1 100644
--- a/Gaussian2D.m
+++ b/Gaussian2D.m
@@ -7,10 +7,12 @@ cy = p(2);
wx = p(3);
wy = p(4);
amp = p(5); % beam amplitude or peak intensity
-theta = p(6); % if beam is ellipticle then it is major axis angle
+theta = p(6); % if beam is elliptical then it is major axis angle
background=p(7);
+% rotate squished beam appropriately
Xn = (X-cx)*cos(theta) - (Y-cy)*sin(theta);
Yn = (X-cx)*sin(theta) + (Y-cy)*cos(theta);
-z = amp*(exp(-2*((Xn).^2./(wx^2)+(Yn).^2./(wy^2)))) + background;
+% finally we calculate Gaussian profile
+z = amp*exp(-2*((Xn/wx).^2+(Yn/wy).^2)) + background;