Borrar filtros
Borrar filtros

Generating points on flattened sphere

1 visualización (últimos 30 días)
Ghulam Murtaza
Ghulam Murtaza el 27 de Ag. de 2016
Comentada: John D'Errico el 28 de Ag. de 2016
hi i am new in matlab I have a flattened sphere x1^2+0.01*x2^2+x3^2=1; I have code but it does not give exact results.
function A = rand_pick_sphere(n,a,b,X,Y,Z)
% Uniform points in a shell of inner radius a, outer radius b and center at
% (X,Y,Z)
% [x,y,z] = rand_pick_sphere(300,.5,.6); % 300 points in shell between
% r = .5 and r = .6, with center at origin.
if nargin==3
X = 0;
Y = 0;
Z = 0;
end
r1 = (rand(n,1)*(b^3-a^3)+a^3).^(1/3);
phi1 = acos(-1 + 2*rand(n,1));
th1 = 2*pi*rand(n,1);
% Convert to cart.
x = r1.*sin(phi1).*sin(th1) + X
y = r1.*sin(phi1).*cos(th1) + Y
z = r1.*cos(phi1) + Z
A=[x y z];
how can generates points that lies on this sphere plz help me
  1 comentario
John D'Errico
John D'Errico el 28 de Ag. de 2016
Why do you think the code that you have is inadequate? Where is the problem?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by