I = imread('coins.png'); 
sobelx=[-1 -2 -1; 0 0 0; 1 2 1];
Ix=filter2(sobelx,I);
sobely=sobelx';
Iy=filter2(sobely,I);
%figure, imshow(Ix,[])
%figure, imshow(Iy,[])
%figure, imshow(mat2gray(Ix.^2+Iy.^2))
figure, imshow(mat2gray(sqrt(Ix.^2+Iy.^2)))
%figure, imshow(mat2gray(abs(Ix)+abs(Iy)))