MATLAB: Plotting positive values for given values of r and phi

curvestoric plot

I am trying to plot the polar values of r and phi that gives positive or zero v_dot values. but i get a line instead. This could is part of another code. Could you guys tell me what I did wrong. Thanks
i = 0;
k = 0;
for phi = 0:.01:2*pi;
flag = 0;
i = i + 1;
j = 0;
for r = .01:0.01:3;
j = j + 1;
v_dot = -1.*r.^2.*(g + 2.*(alpha22 - alpha12).*sin(phi).*cos(phi)) -1.*r.*(alpha21.*cos(phi)- alpha11.*sin(phi));
if v_dot >= 0 & flag == 0
r_b(i) = r;
phi_b(i) = phi;
flag = 1;
k = k + 1;
x1(k) = r.*cos(phi);
x2(k) = r.*sin(phi);
end
end
end
plot(x2,x1)

Best Answer

use find command
t=0:0.1:10
y=sin(t)
idx=find(y>=0)
plot(t(idx),y(idx))