clear clc clf facets = 200 R = 50 x = linspace(0,5,facets); th = linspace(0, 2*pi, facets); [xx, tth] = meshgrid(x, th); radius = 3.*xx.^3 - 4* xx +2; x = xx; y = radius .* cos(tth); z = radius .* sin(tth); surf(x, y, z) xlabel('x') ylabel('y') zlabel('z') shading interp colormap winter lightangle(60, 45)