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!