How to plot a surf-plot of semi sphere in matlab using sphere equation
Show older comments
Hi, I am trying to plot a semi sphere (with out using sphere command in Matlab) using the sphere equation ((x-a)/r)^2+((y-b)/r)^2+((z-a)/r)^2 = 1; But I am confused hot to choose x, y, z. I tried with the below code but I seem to do some thing wrong somewhere...could any one provide me with a better way to do it
x = 0:1:640;
y = 0:1:480;
[x y] = meshgrid(x,y);
z = -((x-320).^2)/(25)-((y-240).^2)/(25)-1;
z(z<0)=0;
figure();
meshc(z);
My end result should look as shown below

Accepted Answer
More Answers (0)
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!