summaryrefslogtreecommitdiff
path: root/Gaussian2D.m
blob: 586ea36486bbd4c2477103a69be4c6530c7d4b97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function [z] = Gaussian2D(p,X,Y);

cx = p(1);
cy = p(2);
wx = p(3);
wy = p(4);
amp = p(5);
theta = p(6);
background=p(7);
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)-2*(Yn).^2./(wy^2))) + background;

z = amp*(exp(-2*((Xn).^2./(wx^2)+(Yn).^2./(wy^2)))) + background;