Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
How to relate x and y coordinate matrices to points on a larger matrix of zeroes?
조회 수: 1 (최근 30일)
이전 댓글 표시
x=zeros(1000); %creates a 100x100 zeros matrix
numRandom = 10; % Generate 10 random locations...
xli = ceil(sqrt(numel(x)) * rand(1, numRandom));
yli = ceil(sqrt(numel(x)) * rand(1, numRandom));
i_theta_max =100;
for i_theta = 0:i_theta_max
theta = i_theta/(i_theta_max)*2*pi;
xcoord(i_theta+1)=1*sin(theta); % Added 1
ycoord(i_theta+1)=1*cos(theta); % Added 1
end
x_index= round(xli'+xcoord)';
y_index= round(yli'+ycoord)';
I have gotten two matrices xli and yli that are my random center point coordinates and the for loop is to try to get all of the points in a circle of radius 1 around those points. From there I rounded with the hope of later plotting them discretely by changing the color value of those points. I don't know how to get my x and y indices to to correspond to the larger x matrix of zeros so that those points and the points within that 'circle' can be changed to a color value. May have gone down the wrong path to get what I'm going for.
댓글 수: 0
답변 (0개)
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!