Based on this question and this one I thought that "imfilter" and "conv2" should have the same results. But try this code you will see the differences. What is the problem?
I = imread('tire.tif');
fil=[1 2 3;4 5 6;7 8 9];
out1=conv2(double(I),fil,'same');
out2=uint8(out1);
out3=imfilter(I,fil,'same');