matlab 如何根据一组圆心坐标函数画圆?

有一1*10的元胞数组,每个元素是一个二维坐标,范围从0~10。现在想把每个坐标当做圆心,半径为1来画圆。当部分圆超出正方形边框时,则不显示。如何操作?

图1:圆心坐标数组:

图2:理想的绘图结果图,当然范围是从0~10.

data={[9.4 8.9],[6.0 6.4],[1.3 2.4],[8.7 6.4],[4.5 1.3],[2.1 9.7],...
    [3.2 3.1],[5.7 4.5],[5.2 8.0],[4.8 5.7]};
t=0:360;
figure
axis([0 10 0 10]);
hold on
for i=1:length(data)
    x=data{i}(1)+sin(t/360*2*pi);
    y=data{i}(2)+cos(t/360*2*pi);
    plot(x,y);
    hold on
end
hold off

希望采纳,设置为满意答案,谢谢

追问

好的 但是圆心出想用红色的“+”号标记呢?

追答

plot(x,y)后面加一行
plot(data{i}(1),data{i}(2),'r+');
希望采纳,设置为满意答案,谢谢

追问

非常好 感谢~

温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-12-31
data={[9.4 8.9],[6.0 6.4],[1.3 2.4],[8.7 6.4],[4.5 1.3],[2.1 9.7],...
[3.2 3.1],[5.7 4.5],[5.2 8.0],[4.8 5.7]};
t=0:360;
figure
axis([0 10 0 10]);
hold on
for i=1:length(data)
x=data{i}(1)+sin(t/360*2*pi);
y=data{i}(2)+cos(t/360*2*pi);
plot(x,y);
hold on
end
hold off
第2个回答  2015-07-05
等符合规范