plot x^2+y^3+z^4=1

25 views (last 30 days)
Kristinn Arnar Ormsson
Kristinn Arnar Ormsson on 16 Sep 2017
Edited: John D'Errico on 16 Sep 2017
I want to plot x^2+y^3+z^4=1 for (x>0, y>0, z>0) but don't quite know how to do it. I have tried the following:
x = 0:0.1:2;
y = x;
z = y;
[X,Y,Z] = meshgrid(x,y,z);
Z = nthroot(1-(Y.^2)-(Z.^3),4);
surf(X,Y,Z)
But i get the following error message:
Error using nthroot (line 31)
If X is negative, N must be an odd integer.
Error in Raknestuga_3_problem_2_c (line 9)
Z = nthroot(1-(Y.^2)-(Z.^3),4);
Any ideas?

Answers (1)

John D'Errico
John D'Errico on 16 Sep 2017
Edited: John D'Errico on 16 Sep 2017
You only need to go as high as 1 for a solution to exist. Beyond that point in x, y, or z, you are raising a number greater than 1 to a power. The sum could never equal 1.
v = 0:0.01:1;
[X,Y,Z] = ndgrid(v,v,v);
p = patch(isosurface(X,Y,Z,X.^2 + Y.^3 + Z.^4,1))
p.FaceColor = 'green';
p.EdgeColor = 'none';
camlight; lighting phong
xlabel 'X'
ylabel 'Y'
zlabel 'Z'

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!