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

1 回表示 (過去 30 日間)
Julie Wanjiru
Julie Wanjiru 2017 年 2 月 15 日
コメント済み: Walter Roberson 2017 年 3 月 26 日
('x' has to be a positive value and 'a' has to entered in degrees then converted to radian)
  1 件のコメント
KSSV
KSSV 2017 年 2 月 15 日
編集済み: KSSV 2017 年 2 月 15 日
It is such simple....there is inbuilt function cos . Read about it.

サインインしてコメントする。

回答 (1 件)

Andres Yie
Andres Yie 2017 年 3 月 26 日
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 件のコメント
Walter Roberson
Walter Roberson 2017 年 3 月 26 日
I think the intent was more
a = input('Enter a in degrees');
x = input('Enter x');
b = x*cosd(a);

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by