Borrar filtros
Borrar filtros

Inner Angle of an Triangle

5 visualizaciones (últimos 30 días)
Marv
Marv el 31 de Oct. de 2016
Comentada: Walter Roberson el 31 de Oct. de 2016
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 ? :-(

Respuestas (3)

Torsten
Torsten el 31 de Oct. de 2016
tan(ang/2) = (B/2) / H
thus
B = 2 * H * tan(ang/2)
Does that help ?
Best wishes
Torsten.

Walter Roberson
Walter Roberson el 31 de Oct. de 2016
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()
  2 comentarios
Marv
Marv el 31 de Oct. de 2016
Hm ok, how can I put this in a loop and save all values:
angles from 0 to 180° at a fix H, lets assume H=6. and ang=0.5 ... 179.9.
into a vector ?
Something like this ?
H=6; for(ang=1:1:179) B = [ang H 2 * H / tand(ang/2)]'; end
Torsten
Torsten el 31 de Oct. de 2016
ang=1:1:179;
H=6.0;
B=2*H*tand(ang/2);
plot(ang,B);
Best wishes
Torsten.

Iniciar sesión para comentar.


Marv
Marv el 31 de Oct. de 2016
If I calculate this, I get for H=6 the result:
B = 4,97056274847714
for an angle at 45.
But it should be B=6 ??
  2 comentarios
Torsten
Torsten el 31 de Oct. de 2016
You mean B=12 for ang=90 and H=6 ?
That's what you get by the formula.
Best wishes
Torsten.
Walter Roberson
Walter Roberson el 31 de Oct. de 2016
Make sure you are using tand() instead of tan() if you are specifying the angle in degrees.

Iniciar sesión para comentar.

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by