Why is my circle invisible?

1 Ansicht (letzte 30 Tage)
Jenny Andersen
Jenny Andersen am 18 Dez. 2019
Kommentiert: Walter Roberson am 18 Dez. 2019
I can not figure out why my circle is invisiable when I plot it (It is a regression). Am I missing something? It used to work earlier.
x = [5; 4; -1; 1];
y = [3; 5; 2; 1];
% circle's equation: x^2+y^2 = 2xc1+2yc2+c3
a = [2.*x,2.*y,ones(length(x),1)];
b = [x.^2 + y.^2];
c = a\b;
x_m = c(1)/2;
y_m = c(2)/2;
r = sqrt(x_m^2 + y_m^2 -c(3));
% plot data points
plot(x,y,'o')
hold on
% plot center
plot(x_m,y_m,'+')
% plot circle
circle(x_m,y_m,r)
hold off
  2 Kommentare
KSSV
KSSV am 18 Dez. 2019
For that we should have a look on the function circle.
Jenny Andersen
Jenny Andersen am 18 Dez. 2019
It is no function, only an expression.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 18 Dez. 2019
Bearbeitet: Walter Roberson am 18 Dez. 2019
viscircles([x_m, y_m], r)
axis equal
  7 Kommentare
Walter Roberson
Walter Roberson am 18 Dez. 2019
Which MATLAB release are you using, and do you have the Image Processing Toolbox (that defines viscircles())
Walter Roberson
Walter Roberson am 18 Dez. 2019
There are File Exchange contributions to draw circles, including https://www.mathworks.com/matlabcentral/fileexchange/59244-circles

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D 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