The plotting function implicit3 fails to render under certain conditions. Notably, for sphere larger than a certain amount.

조회 수: 3 (최근 30일)
This renders properly :
a = 800;
ff = @(x,y,z) x.^2 + y.^2 + z.^2 - a^2;
fimplicit3(ff);
b = a*1.25;
xlim([-b b])
ylim([-b b])
zlim([-b b])
However,
a = 8000;
ff = @(x,y,z) x.^2 + y.^2 + z.^2 - a^2;
fimplicit3(ff);
b = a*1.25;
xlim([-b b])
ylim([-b b])
zlim([-b b])
does not render
  댓글 수: 1
Adam Danz
Adam Danz 2025년 3월 10일
Hello @Vladimir, I ran your code above and the surface renders as expected.
Knowing the MATLAB release you're using and some more information about what you're seeing may help.

댓글을 달려면 로그인하십시오.

채택된 답변

Jack
Jack 2025년 3월 8일
편집: Walter Roberson 2025년 3월 8일
The issue here is likely due to fimplicit3’s default mesh resolution not being sufficient when the plotting range becomes very large. When you set a = 8000, the region over which MATLAB samples the implicit function is huge, and the default number of sample points may be too sparse to accurately capture the surface of the sphere.
One workaround is to explicitly define the plotting region and increase the 'MeshDensity' so that more points are used in the evaluation. For example:
a = 8000;
ff = @(x,y,z) x.^2 + y.^2 + z.^2 - a^2;
b = a*1.25;
fimplicit3(ff, [-b b -b b -b b], 'MeshDensity', 100)
xlim([-b b])
ylim([-b b])
zlim([-b b])
This should provide a denser sampling of the implicit surface and render the sphere correctly.
Follow me so you can message me anytime with future MATLAB questions. If this helps, please accept the answer as well.
  댓글 수: 9

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Adam Danz
Adam Danz 2025년 3월 10일
편집: Adam Danz 2025년 3월 10일
I believe the problem is recreated when the axes limits are not set. In this case, the ImplicitFunctionSurface is larger than the default axes limits and since it does not update the axes limits automatically, there's nothing to render within the default axes. If this is the problem, you solved it by setting the axes limits.
a = 8000;
ff = @(x,y,z) x.^2 + y.^2 + z.^2 - a^2;
fimplicit3(ff);
It would be nice if the implicit graphics objects had an option to automatically adjust the axes limits. Many graphics objects have a property AffectAutoLimits that, when set to True, automatically adjust axes limits so that the object is within the axes. I recently wrote about this property in the Text object. However, the ImplicitFunctionSurface may be continuous along at least once axis which would make it difficult/impossible to automatically select axis limits in the continuous dimentions.

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by