I need a (rho,theta)
meshgrid
and to do that first I defined the meshgrid
in Cartesian coordinates and then convert it to polar coordinates:
[X,Y] = meshgrid(x,y);
R = sqrt(X.^2+Y.^2);
PHI = atan2(Y,X);
Now what I get is a mesh in polar coordinates, but since it is a squared mesh, I get this thing
I say that the values greater than R
are wrong and therefore I set them to zero. I did it in this way
for i = 1:1:length(R)
for j = 1:1:length(R)
if R(i,j) > a
R(i,j) = 0;
else
R(i,j);
end
end
end
How can I do this less convoluted?