Mesh and Surf graphics problem
Mostrar comentarios más antiguos
Hi guys,
I have a problem to display my results in 3D graphics. When I am using MESH function for 2D graphics, results are correct according to values in table. When using SURF function for 3D graphics, I got some extra areas that shouldnt be shown because values are all zero (0) for that areas. Check lower description for details.
Methodology:
Values are shown in table "sesti_sloj" in attachement. To show 2D graphics, I am using mesh function mesh(1:360, 1:180, sesti_sloj). To show 3D graphics, I am using code as follows:
n=1;
for i=1:360
for j=1:90
[x(n), y(n), z(n)] = sph2cart(deg2rad(i),deg2rad(90-(j-1)),sesti_sloj(j,i));
n=n+1;
end
end
x_int = linspace(min(x),max(x), 200);
y_int = linspace(min(y),max(y), 200);
[X, Y] = meshgrid(x_int,y_int);
Z = griddata(x,y,z, X,Y, 'nearest');
surf(X,Y,Z)
n=1;
for i=1:360
for j=91:180
[x(n), y(n), z(n)] = sph2cart(deg2rad(i),deg2rad(90-(j-1)),sesti_sloj(j,i));
n=n+1;
end
end
x_int = linspace(min(x),max(x), 200);
y_int = linspace(min(y),max(y), 200);
[X, Y] = meshgrid(x_int,y_int);
Z = griddata(x,y,z, X,Y, 'nearest');
hold on
surf(X,Y,Z)
I f you check 2D and 3D graphics, you will see some differences that are product of some error I dont understand. For example, check "wings" in 3D graphics on the sides of smaller half-sphere part of graphics. They do not exist in 2D graphics and also those values are all zero (0) in table "sesti_sloj".
Please check if you can help.
Thank you in advance.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Line Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

