Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to plot an implicit surface in Octave?

I could plot the implicit surface (x^8)(y^2)(z^6) = 0 on MATLAB using the fimplicit3 command, but I couldn't find an analogous command in Octave.

Under the impression that MATLAB and Octave are compatible, I copy-pasted the same lines into Octave, and it returned an error message: "error: 'fimplicit3' undefined near line 1 column 1".

How can I plot that on Octave?

like image 863
Mohamed Avatar asked Nov 21 '25 01:11

Mohamed


1 Answers

Not an equivalent function, but if you're simply trying to visualise what an object defined by such an equation looks like in space, you can simply create a grid of points, and obtain the isosurface at 0. This should work well, even for low-res grids.

for example, using the same example shown in matlab's fimplicit3 documentation page, i.e. the equation: , defined in the interval [-5, 5] for x, y, and z, we have:

[x, y, z] = ndgrid(-5:1:5, -5:1:5, -5:1:5);
F = x.^2 + y.^2 - z.^2;
isosurface(F, 0);

You can play around with the properties of the isosurface object, or wrap it in a patch object, introduce isonormals, plot curvature lines on top using plot3, etc etc. In fact I wouldn't be surprised if that's what fimplicit3 is doing under the hood in matlab.


PS: I used matlab's example rather than yours because yours seems a bit trivial: it is trivially zero whenever any of the individual variables are zero. So it's basically the three zero planes intersecting. Not sure if that was intentional or you meant something else

like image 74
Tasos Papastylianou Avatar answered Nov 23 '25 06:11

Tasos Papastylianou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!