MATLAB: Why trigonometry input in degrees gives wrong results

degreesradianstrigonometry

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

Best Answer

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.