The code: for i=1:nr for j=1:nc Theta(i,j) = atand(G_Y(i,j) ./ G_X(i,j)); if Theta(i,j) < 0 Theta(i,j) = 360 + Theta(i,j); end end end the value of atand is between -90 and 90, and the code above should be replaced by Theta = atan2d(G_Y, G_X);
The code:
for i=1:nr
for j=1:nc
Theta(i,j) = atand(G_Y(i,j) ./ G_X(i,j));
if Theta(i,j) < 0
Theta(i,j) = 360 + Theta(i,j);
end
end
end
the value of atand is between -90 and 90, and the code above should be replaced by
Theta = atan2d(G_Y, G_X);