function torus_points = maketorus thing = []; for i = 0:pi/6:2*pi for j = 0:pi/6:2*pi for c = (11:2:15) for a = (5:2:9) x = (c + a*cos(j))*cos(i); y = (c + a*cos(j))*sin(i); z = a*sin(j); thing = [thing; x y z]; end end end end thing = addindex(thing); jimplot3(thing); torus_points = thing;