Ploting constant contours in the same color in matlab
问题 [x,y] = meshgrid(-10:1:10,-10:1:10); idx = (x~=0)&(y~=0); contour(x(idx)/(x(idx).^2+y(idx).^2).^(3/2),y(idx)/(x(idx).^2+y(idx).^2).^(3/2)); the output is white page! 回答1: "delete" the points you do not want: [x,y] = meshgrid(-10:0.1:10,-10:0.1:10); Idontwantthis = (x.^2+y.^2)<1; data= x./(x.^2+y.^2).^(3/2)+y./(x.^2+y.^2).^(3/2); data(Idontwantthis)=NaN; contourf(data,20); Note that I replaced / by ./ I also added more points, as your meshgrid is tiny. This is what the result looks like if