# Can I change degrees to radians by simply changing from sind to sin?

2 Ansichten (letzte 30 Tage)
Nathan Jalal am 6 Aug. 2020
Kommentiert: John D'Errico am 6 Aug. 2020
I have a function that does a basic calculation using some trig. Instead of theta being in degrees can I change it to radians by simply dropping the "d" in sind or cosd or do I have to multiply by pi/180 as well? Here is the function.
theta = atand(n/e);
% Calculating length of vector produced from given coordinates
rTop = sqrt((e^2) + (n^2));
% Calculating length of vector produced from the angle calculated above
rBottom = ((200*300))/ (sqrt((300^2)*(sind(theta))^2 + (200^2)*(cosd(theta))^2));
% If the given coordinates produces a vector that remains within the bottom
% ellipse then the height is equal to the depth of the mine
if rTop - rBottom <= 0
height = depth;
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Matt J am 6 Aug. 2020
Bearbeitet: Matt J am 6 Aug. 2020
cos and sin will assume the input angles are measured in radians. If theta is in degrees, you must convert to radians in order to get proper output from sin and cos
##### 4 Kommentare3 ältere Kommentare anzeigen3 ältere Kommentare ausblenden
John D'Errico am 6 Aug. 2020
atan ALWAYS returns numbers in radians.
atand ALWAYS returns numbers scaled as degrees.
The ratio as an argument to atan has no impact on whether you get degrees or radians. It is purely your choice as to which function you use, if you want degrees or radians as an output.

Melden Sie sich an, um zu kommentieren.

### Kategorien

Find more on Lengths and Angles in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by