在花键建立社交圈

问题描述 投票:2回答:1

我需要如在Matlab示于下面的图像关于沿整个花键或者圆形或六边形的形状要素创建的少量信息。你能告诉我,我怎么能在我的代码实现这一点。

enter image description here

请相对于花创作找到下面的代码

x = -4:4;
y = [0 .15 1.12 2.36 2.36 1.46 .49 .06 0];
cs = spline(x,[0 y 0]);
xx = linspace(-4,4,101);
plot(x,y,'o',xx,ppval(cs,xx),'-');

请让我知道柜面所需的任何其他信息

matlab spline
1个回答
1
投票

那么既然你已经知道的位置要绘制圆(该[x,y]阵列)可以复制你使用的plot代码的一部分,但这次使用较大的标记和不同的颜色,在其中:

hold on
plot(x,y,'o',xx,ppval(cs,xx),'-');
plot(x,y,'o','MarkerSize',80,'Color','g');

它看起来像这样:enter image description here

您可以使用“卦”标记,以及(即使用而不是h o)获得一个六边形:

enter image description here

或者,如果你希望每个圆圈看起来不同或单独控制其属性也可以绘制一个矩形[1 1]的曲率:

radius = .5; 

for k = 1:numel(x)
centerX = x(k);
centerY = y(k);
rectangle('Position',[centerX - radius, centerY - radius, radius*2, radius*2],...
    'Curvature',[1 1],...
    'EdgeColor','g','FaceColor','none');
end
© www.soinside.com 2019 - 2024. All rights reserved.