Why fimplicit3 draw the same function differently

3 ビュー (過去 30 日間)
宗圣
宗圣 2023 年 9 月 7 日
コメント済み: Bruno Luong 2023 年 9 月 7 日
f=@(x,y,z) (x+y+z).^2
fimplicit3(f)
We actually know that this equals to draw the graph of ,but the code turns out to be this:
What happened to the function?
  1 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 9 月 7 日
Seems like a bug -
f=@(x,y,z) (x+y+z).^2;
fun=fimplicit3(f)
fun =
ImplicitFunctionSurface with properties: Function: @(x,y,z)(x+y+z).^2 EdgeColor: [0 0 0] LineStyle: '-' FaceColor: 'interp' Show all properties
No output if Mesh Density is changed, and the axes limits go from the default [-5 5] to [0 1];
figure
fimplicit3(f,'MeshDensity',50)
Specifying interval gives the same result as above
figure
fimplicit3(f,[-5 5],'MeshDensity',50)
I tested the same in my R2021a and it has the same behaviour as above.

サインインしてコメントする。

採用された回答

Bruno Luong
Bruno Luong 2023 年 9 月 7 日
編集済み: Bruno Luong 2023 年 9 月 7 日
This is NOT a bug.
fimplicit3 plot the surface f(x,y,z) = 0, do you must help it by having a function that explicitly cross the level f=0, because it approximate by a tensorial tri-linear and find where it corss the level. But your function is defined as (x+y+z).^2 is always >= 0. Thus fimplicit have a hard time to estimate the surface.
If you add a tiny positive error in your square function it does not cross at all the level f=0.
If you want to determine the surface x+y+z = 0, then do it straight manner
h = @(x,y,z) x+y+z;
fimplicit3(h)
Do not square the function, this is stupid way to chanllenge fimplicit3 numerically.
  2 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 9 月 7 日
"Do not square the function, this is stupid numerically."
How about symbolically?
syms f(x,y,z)
h = (x+y+z)^2;
fimplicit3(h)
"because it approximate by a tensorial tri-linear and find where it corss the level."
Do you have a source for this?
Bruno Luong
Bruno Luong 2023 年 9 月 7 日
Under the hood is numerical surface level, regradless where as your function is symbolic or not.
No I don't have a source but I program myself such level surface. There is nothing sophisticate behind, one just need to decide the cube in voxel and look where the edges cross the level, just like contour in 2D.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumber Theory についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by