Blame view

matlab-3d/gauss1d.m 380 Bytes
bc032fee   Laila Saadatifard   first upload the ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  %This function creates a 1D gaussian window given a standard deviation
  
  function G = gauss1d(sigma)
  
  
      % create a kernel with a radius equal to 4x sigma
      r = sigma * 4;
  
      % create the domain of the gaussian function (x and y)
      gx = -r:r;
      % calculate the gaussian function
      a = 1/(sqrt(2*pi)*sigma);
      b = -1/(2*sigma^2);
      cx = gx.^2;
      G = a.*exp(b.*cx);