Inner Angle of an Triangle
5 次查看(过去 30 天)
显示 更早的评论
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/157532/image.png)
Hello, please look at the attached image. H and ang are given and I would like to calculate B
Moreover I need all angles from 0 to 180° at a fix H, lets assume H=6. and ang=0.5 ... 179.9.
How can I program this in matlab ? :-(
0 个评论
回答(3 个)
Torsten
2016-10-31
tan(ang/2) = (B/2) / H
thus
B = 2 * H * tan(ang/2)
Does that help ?
Best wishes
Torsten.
0 个评论
Walter Roberson
2016-10-31
Divide into two right triangles and use trig. "Adjacent", or x, would be H, "opposite", or y, would be B/2, theta would be ang/2. By trig, x/y = tan(theta), so x / tan(theta) = y . Substiting back in, B/2 = H / tan(ang/2) and so B = 2 * H / tan(ang/2)
Now you can vectorize, B = 2 .* H ./ tan(ang./2) . ang can be a vector
Caution: tan() expects radians. You need to convert, or you need to use tand()
Marv
2016-10-31
2 个评论
Torsten
2016-10-31
You mean B=12 for ang=90 and H=6 ?
That's what you get by the formula.
Best wishes
Torsten.
Walter Roberson
2016-10-31
Make sure you are using tand() instead of tan() if you are specifying the angle in degrees.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!