How to make a Gaussian filter in Matlab
here’s an alternative: Create the 2D-Gaussian: function f=gaussian2d(N,sigma) % N is grid size, sigma speaks for itself [x y]=meshgrid(round(-N/2):round(N/2), round(-N/2):round(N/2)); f=exp(-x.^2/(2*sigma^2)-y.^2/(2*sigma^2)); f=f./sum(f(:)); Filtered image, given your image is called Im: filtered_signal=conv2(Im,gaussian2d(N,sig),’same’); Here’s some plots: imagesc(gaussian2d(7,2.5)) Im=rand(100);subplot(1,2,1);imagesc(Im) subplot(1,2,2);imagesc(conv2(Im,gaussian2d(7,2.5),’same’));