3D plotting of equation

2 views (last 30 days)
samira karimi
samira karimi on 23 Jun 2018
Commented: Walter Roberson on 24 Jun 2018
Hi! I need to plot such an equation (function) in 3D space:
2*x^2+1.5*x*y-.8*x*z+2.5*y^2-3*y*z+z^2-0.35=0.
Everything that I have found, the function is
f(x,y,z)=... or f(x,y)=... .
I tried to use
v=2*x^2+1.5*x*y-.8*x*z+2.5*y^2-3*y*z+z^2;
scatter3(x(:), y(:), z(:), [], v(:));
and slice v=0.35, but turns out only x, y and z could be sliced.
Thank you very much in advance.

Accepted Answer

Walter Roberson
Walter Roberson on 23 Jun 2018
syms x y z
f = 2*x^2+1.5*x*y-.8*x*z+2.5*y^2-3*y*z+z^2-0.35;
fimplicit3(f, [-2 2 -2 2 -2 2])
  3 Comments
samira karimi
samira karimi on 23 Jun 2018
Another question; is there any way to plot a volume of f<=0 instead of just f=0?
Walter Roberson
Walter Roberson on 24 Jun 2018
You can use
f = 2*x^2+1.5*x*y-.8*x*z+2.5*y^2-3*y*z+z^2-0.35 <= 0
with the fimplicit, but for reasons unknown you end up with a chunkier version of the same output when you would expect the same output instead, since <= 0 would just be the filled version of the shape.

Sign in to comment.

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!