function matrix2=smooth2d(matrix1,n)
%function matrix2=smooth2d(matrix1,n)
%            2 dimensional triangle filter (0.25 0.5 0.25)
matrix2=trifilt(matrix1(:));
matrix2=remat(matrix2,matrix1);
matrix2=matrix2';
matrix2=trifilt(matrix2(:));
matrix2=remat(matrix2,matrix1');
matrix2=matrix2';
[imax,jmax]=size(matrix1);
matrix2(1,:)=matrix1(1,:);
matrix2(imax,:)=matrix2(1,:);
matrix2(:,1)=matrix1(:,1);
matrix2(:,jmax)=matrix2(:,1);
