How to draw a simple triangle?
조회 수: 254 (최근 30일)
이전 댓글 표시
I want to draw two simple triangles, (equilateral triangles). Then when i will click on one of the triangle and it will save its values in any file e.g Excel sheet. so any one can help it would be pleasure. Thanks in advance.
My Matlab level is moderate. i dont know too much about it.
Note: I know how to save values in excel. but don't know other stuff.
댓글 수: 0
답변 (3개)
Image Analyst
2014년 11월 23일
You can use line or plot.
line([x1,x2], [y1, y2], 'Color', 'r');
hold on;
line([x2,x3], [y2, y3], 'Color', 'r');
line([x3,x1], [y3, y1], 'Color', 'r');
% get user input
[x, y] = ginput(1);
if inpolygon(..............
and so on.
댓글 수: 0
Konstantin Ninidze
2021년 4월 13일
편집: Image Analyst
2021년 4월 13일
Try this:
p = nsidedpoly(3, 'Center', [1 ,1], 'SideLength', 1);
plot(p);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/582206/image.png)
댓글 수: 2
Daniel Arreguìn
2021년 12월 28일
If you use the same example must be:
p_rotated=rotate(p,theta,rotation_center)
plot(p_rotated)
Muhammad Ali kiani
2019년 11월 25일
i want to draw triangles in rectangle ?? can any one guide me in this regard
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Exploration에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!