用matlab怎么画圆

我要在一个图上画圆 ,知道圆心的坐标,怎么才能画圆 ?用rectangle怎么画 ? x=[pt(i,2)-r,pt(i,1)-r,2*r,2*r];
rectangle('Position',x,'Curvature',[1,1]); 其中 (pt(i,2) ,pt(i,1))是圆心的坐标,r为半径。可是我画出来的圆 ,圆心不在我指定的位置,请大家帮我解答,谢谢 ~~
pt=[2 1; 204 90;327 136; 198 205; 134 218;148 256; 382 286;2 382];
r=20;
for i=1:size(pt,1)
text(pt(i,1),pt(i,2),['\color{red} +',num2str(i)]);
rectangle('position',[pt(i,1)-r,pt(i,2)-r,2*r,2*r],'Curvature',[1,1]);
end
axis square;
圆心不在制定的位置 pt 9*2的矩阵 ,存着圆心的位置

syms a b;
ezplot(  (2-a).^2+(50-b).^2 );

为什么这样画只能出现一个点?不能出现一个圆

答:这时圆没有半径, r=0;


syms a b;
ezplot(  (2-a).^2+(50-b).^2-1 );
解答:(Matlab R2013b)

>> syms a b
>> h=ezplot((2-a)^2+(50-b)^2==1,[1,3,49,51]);axis equal;
>> set(h,'color','r');
>> set(h,'linewidth',2);

参考资料:

>>help sym/ezplot

找Examples:

      syms x y t
      ezplot(cos(x))
      ezplot(cos(x), [0, pi])
      ezplot(x^2 - y^2 == 1)
      ezplot(x^2 + y^2 == 1,[-1.25,1.25],3); axis equal
      ezplot(1/y-log(y)+log(-1+y)+x == 1)
      ezplot(x^3 + y^3 - 5*x*y == 1/5,[-3,3])
      ezplot(x^3 + 2*x^2 - 3*x + 5 == y^2)
      ezplot(sin(t),cos(t))
      ezplot(sin(3*t)*cos(t),sin(3*t)*sin(t),[0,pi])

温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2017-11-23
%(x0,y0)为圆心,r为半径
%方法一
x0=5;
y0=10;
r=3;
theta=0:pi/50:2*pi;
x=x0+r*cos(theta);
y=y0+r*sin(theta);
plot(x,y,'-',x0,y0,'.');
axis square;

%方法二
rectangle('Position',[5-3,10-3,2*3,2*3],'Curvature',[1,1]);
axis square;本回答被提问者采纳
第2个回答  2010-03-11
xx = 3;yy = 5;
r = 2;
rectangle('Position',[xx-r,yy-r,2*r,2*r],'Curvature', [1 1]);

圆心就在(3,5)
把完整的程序发上来看一下吧