Write MATLAB function eqtri(a, b) that plots the graph of the equilateral triangle with two vertices at (a,a) and (b,a). Third vertex lies above the line segment that connects points (a, a) and (b, a). Use function fill to paint the triangle

Write MATLAB function eqtri(a, b) that plots the graph of the equilateral triangle with two vertices at (a,a) and (b,a). Third vertex lies above the line segment that connects points (a, a) and (b, a). Use function fill to paint the triangle
i got this question to solve, but i dont know how to use eqtri(a, b), and couldnt find info about it so if anyone can help me i will be grateful.

Answers (2)

You need to write a function by that name. It is not an existing function, it is the one you need to design and code and test and document.
You need to figure out the coordinates of that third vertex as a general formula in terms of the values 'a' and 'b'. That should be easy. Then plot the outlines of the resulting triangle. Finally figure out how to "paint" its interior using the 'fill' function. In your case the required "polygon" for 'fill' will be just this triangle.

2 Comments

Do "equilateral triangles" exist in Riemannian Geometry ?
I see no reason why they wouldn't exist. However their three inner angles may not sum to 180 degrees.

Sign in to comment.

Asked:

on 2 Jun 2013

Community Treasure Hunt

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

Start Hunting!