Pol2cart function giving wrong cartesian values, why?

7 vues (au cours des 30 derniers jours)
Akintomide Ojo
Akintomide Ojo le 5 Jan 2015
Using the code pol2cart and cart2pol, trying to prove that the rho and theta input can be retrieved back but its not giving the same values. HELP!
prompt1 = 'what is I1?';
prompt2 = 'what is I1 angle?';
RHO = input(prompt1);
THETA = input(prompt2);
[X,Y] = pol2cart(RHO,THETA)
[THETA1,RHO1] = cart2pol(X,Y)

Réponses (1)

Geoff Hayes
Geoff Hayes le 5 Jan 2015
Akintomide - you may need to provide an example of the code not working. Remember, according to pol2cart, the theta must be in radians AND the input to plo2cart is THETA first and then RHO. For example,
RHO = 42.3;
THETA = pi/4;
[X,Y] = pol2cart(THETA,RHO)
[THETA1,RHO1] = cart2pol(X,Y)
produces the expected/desired result.

Catégories

En savoir plus sur Audio Processing Algorithm Design 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