views:

132

answers:

1

I'm trying to find the angle of the the triangle in MATLAB.

e.g. in the triangle below, I want to find the angle of ABC (marked as black). if a = 40, b=50, How I can I find the angle (in degree) of ABC in MATLAB ? alt text

Thanks

+1  A: 

In a right angled triangle, the tangent of of the acute angles can be find by taking the ratio of side opposed to the angle and side it shares with the right angle. These correspond to your values a and b. Then you have to take the inverse tangent of this ratio. This results in atan(a/b).

Pieter
how to write this code in matlab? I mean the tan?
Jessy
The value `a/b` corresponds to the value of `tan`, as you are interested in the value of the actual angle, perform `atan`. That's all there is...
Pieter
Thanks Pieter :-)
Jessy
Hi Peiter... I have tested the atan formula... e.g if I have the opposite=300, and Adjacent = 400, I supposed to have angle as 36.9 ... but using the atan formula, I got different value ..why?tan x=opposite/adjacent=300/400=0.75 , tan of 0.75 --> I supposed to get 36.9 degree but I got different value
Jessy
Because the result is in radians. You want it in degrees. In order to do this multiply by `180 / pi`.
Pieter
Thanks Peiter! you've just made my day! :-)
Jessy