How to create a circle within a matrix
Ältere Kommentare anzeigen
Need to figure out how to create a circle of a specificed size and position, within a premade matrix of zero's. Currently I have the code for the Matrix set and I am able to control the boundaries of the maxtrix. but I would like to be able to place a circle matrix of desired radius and location within the maxtrix of zero's Ive specified
cx1 = .01; %x position of circle
cy1 = .05; %y position of circle
cr1 = .02; %radius of circle
th = 0:pi/100:2*pi;
xunit = cr1 * cos(th) + cx1
yunit = cr1 * sin(th) + cy1
plot (xunit,yunit)
viscircles([centerX, centerY], radius);
x=-.10:.02:.10;
[X,Y]=meshgrid(x); % xy space
v1=zeros(size(X)); % previous v
v1(xunit,yunit)=10 % top boundary CONTROLS COLOR BAR
v1(end,:)=10 % bottom boundary
v1(:,1)=10 % left boundary
v1(:,end)=10 % right boundary
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Histograms finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!