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!