Make a semi sphere and identify the co-ordinates as the shown picture

6 views (last 30 days)
I used this code to make the semisphere but I am trying to pick the co-ordinates based on this picture above, how can we draw around the hemisphere for these specific curve to pick the co-ordinates?
[x,y,z] = sphere; %# Makes a 21-by-21 point sphere
x = x(11:end,:); %# Keep top 11 x points
y = y(11:end,:); %# Keep top 11 y points
z = z(11:end,:); %# Keep top 11 z points
r = 1; %# A radius value
hs = surf(r.*x,r.*y,r.*z, 'FaceColor','white','FaceAlpha',0.5); %# Plot the surface
direction = [0 1 0]; % Specify Direction
axis equal; %# Make the scaling on the x, y, and z axes equal
Ax = get(gca); % Axes Handle
XD = Ax.Children.XData; % Get ‘XData’
Ax.Children.XData = XD + 0.5; % Add 0.5 To ‘XData’ To Shift It To All > 0

Answers (2)

Star Strider
Star Strider on 28 Jun 2022
I am not certain what you want to do.
Calculating and plotting the rings corresponding to the required radii (0.66,0.89,0.99) is straightforward (using some elementary trigonometry) —
[x,y,z] = sphere; %# Makes a 21-by-21 point sphere
x = x(11:end,:); %# Keep top 11 x points
y = y(11:end,:); %# Keep top 11 y points
z = z(11:end,:); %# Keep top 11 z points
r = 1; %# A radius value
hs = surf(r.*x,r.*y,r.*z, 'FaceColor','white','FaceAlpha',0.5); %# Plot the surface
direction = [0 1 0]; % Specify Direction
axis equal; %# Make the scaling on the x, y, and z axes equal
Ax = get(gca); % Axes Handle
XD = Ax.Children.XData; % Get ‘XData’
Ax.Children.XData = XD + 0.5; % Add 0.5 To ‘XData’ To Shift It To All > 0
av = linspace(0, 2*pi, 100); % Rings
av60d = linspace(0, 2*pi, 7); % Microphone Positions
rv = [0.66, 0.89, 0.99];
hold on
for k = 1:numel(rv)
hp31 = plot3(rv(k)*cos(av)+0.5, rv(k)*sin(av), ones(size(av))*sin(acos(rv(k))), '-r', 'LineWidth',2);
end
hold on
for k = 1:numel(rv)
hp32 = plot3(rv(k)*cos(av60d)+0.5, rv(k)*sin(av60d), ones(size(av60d))*sin(acos(rv(k))), 'og', 'MarkerSize',10, 'MarkerFaceColor','g');
end
hold off
legend([hs,hp31(1),hp32(1)],'Sphere','Radius Rings','Microphone Positions', 'Location','best')
% view(90,0)
.

William Rose
William Rose on 28 Jun 2022
YOu make a 21x21 array, i.e. 441 elements. I only see 20 points shown on the diagram, so three vectors of length 20 should suffice.
x=zeros(1,20); y=zeros(1,20); z=zeros(1,20); %allocate arrays for x,y,z
I interpret the figure to mean that the apex of the sphere is used twice: point 20 is the same as point 10; they both have x=y=0, and z=1.
You know the hemisphere radius=1, so every point satifies x^2+y^2+z^2=1. Use that and the dimensions in the figure to figure it all out. The top figure shows that points 1,2,3 and 11,12,13 lie on a slice, or ring, with z=0.15 and x-y radius=0.99. Note that 0.15^2+0.99^2=1.00, so these dimensions are consistent with the hemisphere radius=1.00. Based on the info above, we can write
z(1)=0.15; z(2)=0.15; z(3)=0.15; z(11)=0.15; z(12)=0.15; z(13)=0.15;
Matlab shorthand for the code above is as follows. We will use this idea in subsequent lines also.
z([1,2,3,11,12,13])=0.15*ones(1,6);
You can figure out the x,y values by noticing that the bottom figure shows that the x,y coordinates will be given by x=r*cosd(a), y=r*sind(a), where a=angle in degrees of each point, measured in the usual way: CCW from the +x axis, and where r=circle radius in the x-y plane=0.99. (We got the radius r=0.99 for these points from the top figure.) Points 1,2,3,11,12,13 are at angles 180,-60,+60,0,120,-120 degrees, respectively, as you can see by inspecting the lower figure. So we have
x([1,2,3,11,12,13])=0.99*cosd([180,-60,60,0,120,-120]);
y([1,2,3,11,12,13])=0.99*sind([180,-60,60,0,120,-120]);
%Next: plot the points so far
plot3(x(1),y(1),z(1),'r*',x(2),y(2),z(2),'g*',x(3),y(3),z(3),'b*',...
x(11),y(11),z(11),'ro',x(12),y(12),z(12),'go',x(13),y(13),z(13),'bo');
legend('1','2','3','11','12','13');
xlabel('X'), ylabel('Y'), zlabel('Z')
axis equal, grid on
axis([-1.2,1.2,-1.2,1.2,0,1.2])
Apply the ideas above to the remaining points. When you run the code above in Matlab, you will be able to click and drag in the 3D plot, to rotate it. This helps you see where the points are.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by