Plot a function of three variable

263 visualizaciones (últimos 30 días)
Md Borhan Mia
Md Borhan Mia el 16 de En. de 2019
Comentada: VBBV el 12 de Abr. de 2023
Hey, I want to plot a function of three variables. Consider that I have a function like f(x,y,z)=x^2+y^2+z^2-3xyz, I want a surface plot of this function. How can I do that? Thanks!

Respuestas (1)

KSSV
KSSV el 16 de En. de 2019
f = @(x,y,z) x.^2+y.^2+z.^2-3*x.*y.*z ;
x = linspace(-1,1) ;
y = linspace(-1,1) ;
z = linspace(-1,1) ;
[X,Y,Z] = ndgrid(x,y,z) ;
F =f(X,Y,Z) ;
figure
hold on
for i = 1:100
surf(X(:,:,i),Y(:,:,i),Z(:,:,i),F(:,:,i)) ;
end
  3 comentarios
Shubham
Shubham el 17 de Nov. de 2020
syms X Y Z
f = @(x,y,z) x^2 + y^2 + z^2;
surff = f(X,Y,Z);
fimplicit3(surff)
VBBV
VBBV el 12 de Abr. de 2023
@Md Borhan Mia you can use view to visualize a 3D plot
f = @(x,y,z) x.^2+y.^2+z.^2-3*x.*y.*z ;
x = linspace(-1,1) ;
y = linspace(-1,1) ;
z = linspace(-1,1) ;
[X,Y,Z] = ndgrid(x,y,z) ;
F =f(X,Y,Z) ;
figure
hold on
for i = 1:100
surf(X(:,:,i),Y(:,:,i),Z(:,:,i),F(:,:,i)) ;
end
view(45,45)

Iniciar sesión para comentar.

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by