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
Show older comments
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)
Walter Roberson
on 2 Jun 2013
0 votes
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.
Roger Stafford
on 2 Jun 2013
0 votes
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
Walter Roberson
on 2 Jun 2013
Do "equilateral triangles" exist in Riemannian Geometry ?
Roger Stafford
on 3 Jun 2013
I see no reason why they wouldn't exist. However their three inner angles may not sum to 180 degrees.
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!