How to draw a simple triangle?

331 vues (au cours des 30 derniers jours)
Adnan Ali
Adnan Ali le 22 Nov 2014
Commenté : Daniel Arreguìn le 28 Déc 2021
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.

Réponses (3)

Konstantin Ninidze
Konstantin Ninidze le 13 Avr 2021
Modifié(e) : Image Analyst le 13 Avr 2021
Try this:
p = nsidedpoly(3, 'Center', [1 ,1], 'SideLength', 1);
plot(p);
  2 commentaires
Ahmed Elakhder
Ahmed Elakhder le 27 Mai 2021
how can I draw a rotated triangle with a certain angle?
Daniel Arreguìn
Daniel Arreguìn le 28 Déc 2021
If you use the same example must be:
p_rotated=rotate(p,theta,rotation_center)
plot(p_rotated)

Connectez-vous pour commenter.


Image Analyst
Image Analyst le 23 Nov 2014
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.

Muhammad Ali kiani
Muhammad Ali kiani le 25 Nov 2019
i want to draw triangles in rectangle ?? can any one guide me in this regard

Catégories

En savoir plus sur Data Exploration dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by