gauss1d.m
380 Bytes
%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);