fname = input('\nEnter filename (without extension)\n'); format = input('\nEnter image format extension\n'); A = imread(fname,format); % Load the file figure(); % New figure window for image colormap('gray'); % Change to grayscale imagesc(A); % Show image figure(); % New figure window for spectrum Y = fft2(double(A)); % Compute image spectrum Z = log(abs(fftshift(Y))); % Put origin in center. Use log plot! Z2 = uint8(Z/max(max(Z))*255); % Normalize to maximum value in order % to get best "picture" of spectrum colormap('gray') % Change to grayscale imagesc(Z2); % Show normalized image spectrum