MATLAB: Plotting a spherical segment 3d plot Hi, I need to plot a spherical segment (blue region of the sphere in the attached picture). Do you have any suggestions? Gilles Best Answer clc; clear all ;[X,Y,Z] = sphere(200) ;surf(X,Y,Z) ;r = 1; b = 0.9 ; h = 1 ;%%Get radius R = sqrt(X.^2+Y.^2) ;X1 = X ; Y1 = Y ; Z1 = Z ;X1(Z<r/2) = NaN ; Y1(Z<r/2) = NaN ; Z1(Z<r/2) = NaN ; X1(Z>b) = NaN ; Y1(Z>b) = NaN ; Z1(Z>b) = NaN ; surf(X1,Y1,Z1) ;axis equal % shading interp ; Related SolutionsMATLAB: How do i count a certain class of numbers in a 100×100 matrix >> sum(~imag(za(:))) ans = 8627 MATLAB: How to sketch correctly Here is a starttry this line to draw the part you are interested inz1 = (x/2+1).^2 + y.^2/4;surface(x/2+1, y/2, z1, 'FaceColor', 'r');DOes it look familiar to you? Related QuestionLabels don’t appear in 3d plotHow to Generate 100 Random points inside the figureProducing a MatrixHow to plot an EllipseUndefined function ‘f’
Best Answer