what is command for instead DEGREES(ATAN2(A2,B2)) formula in excel??
Show older comments
Dear all !!!
I tried to change formula from excel file to matlab function. But result didnot same as figure.

Can anyone help me to explain and fix it?
Thank you
6 Comments
E = [-0.01462;-20.5145;-0.01462];
N = [6.18e-8;-13.9457;1.22e-7];
atan2d(N,E)
Please upload your actual data in a mat file by clicking the paperclip button.
galaxy
on 3 Jun 2022
It seems to be related to your MATLAB version or code:
S = load('testData.mat')
V = atan2d(S.N,S.E);
fprintf('%3d %+23.18f %+23.18f %+23.18f\n',[1:22;S.E.';S.N.';V.'])
dpb
on 3 Jun 2022
@galaxy - not all Q3 values are -ive it appears; looks like it's a bug related to the small size of the N argument at what looks to be the size of precision for single precision.
It would seem a bug; would have to search the bug list to see when it was reported/fixed; current releases return the expected result.
If you can't upgrade, it would seem you would have to write a user replacement that checks and corrects sign.
David Goodmanson
on 4 Jun 2022
Hi galaxy,
exactly how, in what environment, are those values of -179... being calculated? Certainly if you import the values of E and N into Matlab, you get +179... as you should.
galaxy
on 8 Jun 2022
Answers (1)
Benjamin Thompson
on 4 Jun 2022
0 votes
Since -179 and 179 degrees are very nearly equal, those results are actually within the tolerance of your other results. If you used the wrong sign on the "N" component this would explain it, and just keep in mind when very small number and very large numbers are used together in calculations this can lead to odd results. Also is the Excel screenshot showing any rounding, such that the calculations are using additional digits of precision that Excel is not displaying?
Categories
Find more on Logical 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!