Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

How to relate x and y coordinate matrices to points on a larger matrix of zeroes?

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (0)

Questa domanda è chiusa.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by