Plot circle in meters
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Brandon
2015 年 3 月 13 日
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 件のコメント
Brandon
2015 年 3 月 13 日
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.
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!