plotting concentric circles using contour

12 Ansichten (letzte 30 Tage)
Randy Chen
Randy Chen am 26 Okt. 2020
Kommentiert: Star Strider am 27 Okt. 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)

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by