フィルターのクリア

Calculating sin and cos functions

178 ビュー (過去 30 日間)
Mohsin Shah
Mohsin Shah 2011 年 5 月 29 日
コメント済み: Walter Roberson 2021 年 12 月 18 日
Hello, i calculated the value of sin(45) in Matlab, the result was sin(45)=0.8509 and for cosin i got cos(45)= 0.5253. From general mathematics we know that sin(45)=cos(45) then why Matlab is giving different results??

採用された回答

Paulo Silva
Paulo Silva 2011 年 5 月 29 日
Those functions work in radians not degrees, try this
cosd(45)
sind(45)
  3 件のコメント
Abdullah Amin
Abdullah Amin 2021 年 12 月 18 日
y=sin(-75) then y variable should carry value
+1 -1 +75 -75
Walter Roberson
Walter Roberson 2021 年 12 月 18 日
It is not clear to me why sin() of a scalar should result in a vector of length 4 ? Or why those particular values should be output ?

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

その他の回答 (1 件)

bym
bym 2011 年 5 月 29 日
sin() & cos() arguments are in radians. If you want degrees use
sind() cosd()
  3 件のコメント
Muhammed Çelik
Muhammed Çelik 2020 年 4 月 20 日
or, you can do like this sin(degree*pi/180)
Steven Lord
Steven Lord 2020 年 4 月 20 日
If you're going to convert degrees to radians or vice versa, use the deg2rad or rad2deg functions moved from Mapping Toolbox to MATLAB in release R2015b rather than the "magic number" of pi/180.

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

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by