我要在一个图上画圆 ,知道圆心的坐标,怎么才能画圆 ?用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])