graph - MATLAB Surface Plotting -
i want plot region (of integration) in 3d-space given conditions -1<=x<=1, 0<=y<=1, 0<=z<=1-x^2
translucent single-coloured faces in 'wireframe'.
my solution draws 4 bounding surfaces of region separately. used surf()
bottom face lies on x-y plane , top face; surf()
doesn't seem work 2 vertical faces. hence guess there has easier way draw this...
cludgiest code ever:
figure hold on x = linspace(-1,1,30); y = linspace(0,1,30); [x,y] = meshgrid(x,y); z = 1-x.^2; h = surf(x,y,z); set(h,'edgecolor','none','facecolor','r','facealpha',0.5); z = zeros(30); h = surf(x,y,z); set(h,'edgecolor','none','facecolor','r','facealpha',0.5); y = ones(30); z = 1-x.^2; y = x.*0; h = fill3(x,y,z,'r'); alpha(h,0.5); y = y+1; h = fill3(x,y,z,'r'); alpha(h,0.5); y = linspace(0,1,30); x = y.*0+1; z = y.*0 plot3(x,y,z,'k')
Comments
Post a Comment