How to use the Meshgrid and surf functions?
33 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Giovanni Virgen
le 4 Juil 2018
Réponse apportée : Walter Roberson
le 4 Juil 2018
I need to create a script that uses the meshgrid and surf functions to generate a 3-D surface plot of the function z = cos(sqrt(x^2 + y^2)) in the domain −7 ≤ x ≤ 7 and −7 ≤ y ≤ 7 (use a step size of 0.1). How would you do this?
0 commentaires
Réponse acceptée
Walter Roberson
le 4 Juil 2018
v = -7:0.1:7;
[x, y] = meshgrid(v, v);
z = cos(sqrt(x.^2 + y.^2));
surf(x, y, z, 'edgecolor', 'none')
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!