フィルターのクリア

why trigonometry input in degrees gives wrong results

3 ビュー (過去 30 日間)
Madhu
Madhu 2014 年 7 月 12 日
編集済み: Azzi Abdelmalek 2014 年 7 月 12 日
Hello, Here is a simple trigonometry functions where i have given data in degrees and radians, why i am getting a wrong result when i am giving in degrees.
>> a=30 a =
30
>> b=pi/6
b =
0.5236
>> c=sin(a)
c =
-0.9880
>> d=sin(b)
d =
0.5000

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 7 月 12 日
編集済み: Azzi Abdelmalek 2014 年 7 月 12 日
If a is in degree you need to use another function
sind(3)
Also, when you say a is in degree, you know this, but how the function sin knows if it's degree or rad? the function sin consider a in radian.

その他の回答 (1 件)

Image Analyst
Image Analyst 2014 年 7 月 12 日
Use the "d" versions of the trig functions when you want to input in degrees:
sind(30) % Uses sind() rather than sin().
sin(pi/6)
ans = 0.5
ans = 0.5

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by