Mesh : Display only nonzero values

9 vues (au cours des 30 derniers jours)
Joon Choi
Joon Choi le 5 Fév 2021
Commenté : Joon Choi le 5 Fév 2021
When I draw a 3D graph with a mesh, I only want to display non-zero values. What should I do?
Please help me!
Thank you.

Réponse acceptée

the cyclist
the cyclist le 5 Fév 2021
In this code, I take the first example from the documenation for mesh, and don't plot the negative values by setting them to NaN:
[X,Y] = meshgrid(-8:.5:8);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
Z(Z<0) = nan; % Set negative values to NaN, so that they are not plotted
figure
mesh(X,Y,Z)
You should be able to do the equivalent thing, with
Z(Z==0) = nan;
  1 commentaire
Joon Choi
Joon Choi le 5 Fév 2021
Wow!!
Thank you so much!!!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Discrete Data 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!

Translated by