summaryrefslogtreecommitdiff
path: root/fitGaussian1D.m
blob: b3fbb56885544868a0aab40d444c0851774cbd89 (plain)
1
2
3
4
5
6
7
8
9
10
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);