Plot circle in meters
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I'm trying to plot several circles 5 meters in size within a room represented by the gird
pos = [0 0 5 5];
pos2 = [10 10 5 5];
pos3 = [20 20 5 5];
pos4 = [30 30 5 5];
rectangle('Position',pos,'Curvature',[1 1])
rectangle('Position',pos2,'Curvature',[1 1])
rectangle('Position',pos3,'Curvature',[1 1])
rectangle('Position',pos4,'Curvature',[1 1])
axis equal
axis([0 100 0 100])
I'm using the axis to represent the room size so in this case 100 meters by 100 meters. Sometimes the room size might vary say double so 200x200 and the graph then scales and everything gets smaller.
What I was hoping is everything stayed the same size but the graph grew its size rather than scale it down the fit within the small graph size
Is this possible
Thanks
0 Kommentare
Antworten (1)
Brandon
am 13 Mär. 2015
Try something like this:
figure();
AX(1) = axes;
axis equal
hold('on');
set(AX(1), 'XLim', [0 100], 'YLim', [0 100]);
XC = 2.5*sin(linspace(0,2*pi,100)); YC = 2.5*cos(linspace(0,2*pi,100));
h(1) = fill(XC + 50, YC + 50, 'r'); % create circle
2 Kommentare
Brandon
am 13 Mär. 2015
You just need to express the circle size as a percentage of the room size. In this case I set the room to be 100 and the circle size to be 2.5. You can set the room size to be n and the circle size to be n/10.
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!