フィルターのクリア

Bug with cosd and sind functions

2 ビュー (過去 30 日間)
Daniele Oboe
Daniele Oboe 2017 年 9 月 4 日
回答済み: Steven Lord 2017 年 9 月 4 日
The first numerical derivative of the function sine should give the cosine, but there is an error with the degree functions. The equivalent radiant functions works fine. I have found this problem in Matlab R2016b but I still have it on the R2017a release.
>> ( sin(pi/6+0.00001) - sin(pi/6-0.00001) )/(2*0.00001)
ans =
0.8660
>> cos(pi/6)
ans =
0.8660
>> ( sind(30+0.0001) - sind(30-0.0001) )/(2*0.0001) % error
ans =
0.0151
>> cosd(30)
ans =
0.8660

採用された回答

Steven Lord
Steven Lord 2017 年 9 月 4 日
This is not a bug. The derivative of sin(x) with respect to x is cos(x). But sind(x) is not sin(x), it is sin(k*x) for a constant k. See this Wikipedia page.

その他の回答 (0 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by