I keep getting a 'parse error' at '='

3 vues (au cours des 30 derniers jours)
Nadine Nassar
Nadine Nassar le 21 Sep 2019
Commenté : Nadine Nassar le 27 Sep 2019
  • All my equal signs are underligned saying that there's a parse error, can someone help me with this?
function [r,theta] = polar_coordinates(x,y)
r = sqrt ((x^2)+(y^2))
if(x>0)
theta = arctan(x/y)
end
if (x<0)
if (y>0)
theta = arctan(x/y) + pi
if (y<0)
theta = arctan(x/y) - pi
if (y=0)
theta = pi
end
end
end
end

Réponse acceptée

Bruno Luong
Bruno Luong le 21 Sep 2019
Test wth "=="
if (y==0)
  1 commentaire
Nadine Nassar
Nadine Nassar le 27 Sep 2019
Thanks a lot!!

Connectez-vous pour commenter.

Plus de réponses (1)

Catégories

En savoir plus sur Logical 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