How do I find the base of a right angle triangle b=xcos(a) in matlab.

1 vue (au cours des 30 derniers jours)
Julie Wanjiru
Julie Wanjiru le 15 Fév 2017
Commenté : Walter Roberson le 26 Mar 2017
('x' has to be a positive value and 'a' has to entered in degrees then converted to radian)
  1 commentaire
KSSV
KSSV le 15 Fév 2017
Modifié(e) : KSSV le 15 Fév 2017
It is such simple....there is inbuilt function cos . Read about it.

Connectez-vous pour commenter.

Réponses (1)

Andres Yie
Andres Yie le 26 Mar 2017
Use the comands:
a = input('Enter a in radians')
x = input('Enter x')
a = rad2deg(a) %Converts to degrees
b = x*cosd(a);
Also you can skip the radinas and use the cos() function that accepts the argument in radians.
  1 commentaire
Walter Roberson
Walter Roberson le 26 Mar 2017
I think the intent was more
a = input('Enter a in degrees');
x = input('Enter x');
b = x*cosd(a);

Connectez-vous pour commenter.

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by