Surf command to plot simple surface
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Bobby Fischer
le 2 Oct 2021
Modifié(e) : Ravi Narasimhan
le 2 Oct 2021
Hi
what is happening here:
close all
x = -1 : 0.1 : 5;
y = x;
[X, Y] = meshgrid(x,y);
Z = 2*X - X*Y + 2*Y;
surf(X, Y, Z)
xlabel('Ox')
ylabel('Oy')
zlabel('Oz')
0 commentaires
Réponse acceptée
Ravi Narasimhan
le 2 Oct 2021
Modifié(e) : Ravi Narasimhan
le 2 Oct 2021
Did you intend to do an element-by-element multiply on X and Y?
close all
x = -1 : 0.1 : 5;
y = x;
[X, Y] = meshgrid(x,y);
Z = 2*X - X.*Y + 2*Y; % Note the .*
surf(X, Y, Z)
xlabel('Ox')
ylabel('Oy')
zlabel('Oz')
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!