Question about how the isosurface function works

17 views (last 30 days)
Hi All,
I'm currently working on trying to write some code to plot an isosurface, and I had a basic question about how the isosurface works.
Let say I want to plot an isosurface with isovalue = 1. However, my data doesn't have any value which is exactly = 1.00000. The data is something like 0.9899, 1.0129, etc. So theoretically my isosurface should be blank right, because I don't have any value which is exactly = 1.0000. Yet I do get an output, which is also reasonable according to my data.
I was wondering what's the in built tolerance the code has? Does it perhaps plot an isosurface for points 1.000 +- 0.001? Furthermore, can I know and control the tolerance value to which the isosurface is plotted at?
Any help would really be appreciated!
Thanks!

Accepted Answer

John D'Errico
John D'Errico on 20 Sep 2022
Edited: John D'Errico on 20 Sep 2022
isosurface cannot use interpolation? Why not? All that is necessary is the ability to perform LINEAR interpolation, between pairs of points, nothing more.
For example, how does a contour plot work? Again, even though you do not have specific data points at a SPECIFIC level, you can still generate a contour plot. For example:
[X,Y] = meshgrid(0:.25:2);
Z = X.^2+Y.^2;
contour(X,Y,Z,[1 1])
grid on
hold on
plot(X,Y,'.')
Do you see that the contours are actually straight line segments between a set of points? As well, do you see those segments need not fall on the grid itself? The line segments cross between pairs of points. We can get the contour itself, as the points:
CXY = contourc(0:.25:2,0:.25:2,Z,[1 1])
CXY = 2×9
1.0000 1.0000 0.9643 0.8571 0.7500 0.6500 0.5000 0.2500 0 8.0000 0 0.2500 0.5000 0.6500 0.7500 0.8571 0.9643 1.0000
Read the help for contourc to see what was produced.
A simple linear interpolation is all that is necessary. And what is an isosurface, but a contour plot, in THREE dimensions?
  2 Comments
Kaustubh Panse
Kaustubh Panse on 20 Sep 2022
Thanks for your answer John!
Just to make sure I got it correctly, do you mean to say that the isosurface function linearly interpolates my raw data so that it can plot the isosurface with the specified isovalue?
If this is the case, would you happen to know any documentation where it's specified whats the step size of the linear interpolation?
Thanks for your help!
Kaustubh Panse
Kaustubh Panse on 20 Sep 2022
Hi John,
Thank you so much for your detailed answer! Please excuse my previous comment; I could only somehow see part of your answer, so I commented for more information.
I can see the full answer now and it's really helpful!
Thanks again!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!