Program Matlab konvolusi


function konvolusidata
A=[4 4 3 5 4;6 6 5 5 2;5 6 6 6 2;6 7 5 5 3;3 5 2 4 4];
m=[0 -1 0;-1 4 -1;0 -1 0];
d=A
[baris kolom]=size(A);
for i=2:baris-1;
for j=2:kolom-1;
d(i,j)=A(i-1,j-1)*m(1,1)+A(i-1,j)*m(1,2)+A(i-1,j+1)*m(1,3)+A(i,j-1)*m(2,1)+A(i,j)*m(2,2)+A(i,j-1)*m(2,3)+A(i+1,j-1)*m(3,1)+A(i+1,j)*m(3,2)+A(i+1,j+1)*m(3,3);
if d(i,j)>255
d(i,j)=255;
else if d(i,j)
d(i,j)
end
end
end
end
Previous
Next Post »