Q(1) Find Octave commands for constructing a 256 x 256 matrix with entries of 0 everywhere except inside a circle with radius 50 where the values are 1.
Ans.
C=zeros(256);
for x=1:256;
for y=1:256;
if (x-128)^2+(y-128)^2 <= 2500;
C(x,y)=1;
end;
end;
end;
C1=255*C;
imshow(C1);
No comments:
Post a Comment