MATLAB: How to plot and combine in one graph

matlab functionmultivariable functionsplotting mutivariate functions

Hello everyone;
Need help in plotting all these three functions on a single graph.
U=nthroot(1-x^3-y^3-z^3,3)
V=nthroot(1-x^2-y^2-z^2, 2)
W=(1-x-y-z)
Thanks

Best Answer

Since you have 3 independent variables, you will need to use slice() and create 3 figures.
[X, Y, Z] = meshgrid(-0.5:0.02:0.5);
U = nthroot(1-X.^3-Y.^3-Z.^3, 3);
V = nthroot(1-X.^2-Y.^2-Z.^2, 2);
W = (1-X-Y-Z);
figure
slice(X, Y, Z, U, [-0.4 0 0.3], 0, 0.3)
title('U')
colorbar
shading interp
figure
slice(X, Y, Z, V, [-0.4 0 0.3], 0, 0.3)
title('V')
colorbar
shading interp
figure
slice(X, Y, Z, W, [-0.4 0 0.3], 0, 0.3)
title('W')
colorbar
shading interp
Related Question