Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't Matlabs Isosurface work here?

I'm trying to plot/visualize following solid:

[![enter image description here](https://i.sstatic.net/f5nicaE6.png)](https://i.sstatic.net/f5nicaE6.png)

This is what I coded so far:

% Create the set of 3D points
n = 150;
x = linspace(1, 2, n); 
y = linspace(0, 1, n);
z = linspace(0, 1, n);
[X, Y, Z] = meshgrid(x, y, z); 

% Create 3D logical mask for the volume
mask = (1 <= X) & (X <= 2) ... % Constraints of x
     & (0 <= Y) & (Y <= 1./X) ... % Constraints of y
     & (0 <= Z) & (Z <= sqrt(Y)); % Constraints of z

figure;
isosurface(X, Y, Z, mask, 0.5);
daspect([1 1 1]);
view(3);
grid on;

xlabel('x'); ylabel('y'); zlabel('z');
title('Isosurface visualization of the solid volume');

But the result only shows two of the faces of the solid. But completely disregards the flat faces: enter image description here

Any ideas on what went wrong?


Btw, this is the solid using matlabs volshow function. But I would still prefer isosurface.

enter image description here

like image 735
haifisch123 Avatar asked Sep 03 '25 04:09

haifisch123


1 Answers

If you go just past the boundaries on your grid it works:

x = linspace(0.9, 2.1, n); 
y = linspace(-0.1, 1.1, n);
z = linspace(-0.1, 1.1, n);

enter image description here

like image 190
Ramashalanka Avatar answered Sep 04 '25 23:09

Ramashalanka