MATLAB Answers

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

2 views (last 30 days)
  • 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

  0 Comments

Sign in to comment.

Accepted Answer

Bruno Luong
Bruno Luong on 21 Sep 2019
Test wth "=="
if (y==0)

  1 Comment

Sign in to comment.

More Answers (1)

Sign in to answer this question.


Translated by