Use imread to read an image from file
Convert to grayscale (rgb2gray)
Use fspecial to create convolution filter
Use conv2 to run convolution
Use imshow to display result (use empty brackets '[]' to automatically rescale output )
imshow(image, [])
Use fft2 and fftshift.
In the resulting spectrum - low frequencies are represented by values near the center. Higher the frequency, further away it is from the center.
Adjust values in shifted spectrum and perform ifftshift and ifft2.
For low pass filtering set values further away from the center to zero (black area in the mask)
For high pass filtering set values close to the center to zero. (black dot in the middle of the mask)
Create your spectrum masks with the use of the fspecial to get smoothed version (see image below).