# angle function in matlab formula

15 vues (au cours des 30 derniers jours)
Manu Chaudhary le 22 Sep 2022
Modifié(e) : James Tursa le 23 Sep 2022
Hi everyone,
I am trying to understand the functionality of angle function of matlab. I am trying to convert my matlab code(which we use for proof of concept) to C++ implementation.
input to angle function - 0.487936206701072 + 0.660466136142335i
output of angle function - 0.934517679414299
I know it must be tan-inverse(img/real) with some other constant.
Please help me with the formula?
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (1)

Torsten le 22 Sep 2022
Modifié(e) : Torsten le 22 Sep 2022
It's all written in the MATLAB documentation of "angle":
Algorithms
angle takes a complex number z = x + iy and uses the atan2 function to compute the angle between the positive x-axis and a ray from the origin to the point (x,y) in the xy-plane.
Here is the "proof":
format long
z = 0.487936206701072 + 0.660466136142335*1i;
angle(z)
ans =
0.934517679414299
atan2(imag(z),real(z))
ans =
0.934517679414299
##### 7 commentairesAfficher 5 commentaires plus anciensMasquer 5 commentaires plus anciens
Manu Chaudhary le 23 Sep 2022
Yes, atan function works in c++ but not atan2.
Torsten le 23 Sep 2022

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Call C++ from MATLAB dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by