plotting concentric circles using contour

29 vues (au cours des 30 derniers jours)
Randy Chen
Randy Chen le 26 Oct 2020
Commenté : Star Strider le 27 Oct 2020
I'm trying to plot a few concentric circles with the following codes, but what I get is an ellipse, i don't know why:
[x,y] = meshgrid(-3:0.1:3,-3:0.1:3);
z = x.^2+y.^2;
contour(x,y,z)

Réponse acceptée

Star Strider
Star Strider le 26 Oct 2020
Use the axis function, specifically either:
axis('equal') % Function Expression
or:
axis equal % Command Expression
.
  5 commentaires
Randy Chen
Randy Chen le 27 Oct 2020
thanks a lot!
Star Strider
Star Strider le 27 Oct 2020
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by