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
2025-3-10
Knowing the MATLAB release you're using and some more information about what you're seeing may help.
采纳的回答
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.
更多回答(1 个)
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!






