私は、質問の最後に追加した「円軌跡」と同様に、六角形の軌跡に沿って星マーカーを移動したいと思います。ありがとう。六角形の軌跡に沿って星マーカーを移動しますか?
これは私が同心hegzagonsを作成するためにはまだ書かれているように、ソースコードですが、私は同心円状の六角形を横断スターマーカーを移動する方法がわからない、私は円軌道のための同様のシミュレーションコードを書いていたが、私は六角形ではできませんでした。
%clc; % Clear the command window.
%close all; % Close all figures (except those of imtool.)
%clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
angles = linspace(0, 360, 7);
radii = [20, 35, 50,70];
% First create and draw the hexagons.
numberOfHexagons = 4;
% Define x and y arrays. Each row is one hexagon.
% Columns are the vertices.
x1=radii(1) * cosd(angles)+50;
y1 = radii(1) * sind(angles)+50;
x2=radii(2) * cosd(angles)+50;
y2 = radii(2) * sind(angles)+50;
x3=radii(3) * cosd(angles)+50;
y3 = radii(3) * sind(angles)+50;
x4=radii(4) * cosd(angles)+50;
y4 = radii(4) * sind(angles)+50;
plot(x1 , y1, 'b');
hold on
plot(x2, y2, 'b');
hold on
plot(x3, y3, 'b');
hold on
plot(x4, y4, 'b');
hold on
% Connecting Line:
plot([70 100], [50 50],'color','b')
axis([0 100 0 100])
hold on
円軌道:
% Initialization steps.
format long g;
format compact;
fontSize = 20;
r1 = 50;
r2 = 35;
r3= 20;
xc = 50;
yc = 50;
% Since arclength = radius * (angle in radians),
% (angle in radians) = arclength/radius = 5/radius.
deltaAngle1 = 5/r1;
deltaAngle2 = 5/r2;
deltaAngle3 = 5/r3;
theta1 = 0 : deltaAngle1 : (2 * pi);
theta2 = 0 : deltaAngle2 : (2 * pi);
theta3 = 0 : deltaAngle3 : (2 * pi);
x1 = r1*cos(theta1) + xc;
y1 = r1*sin(theta1) + yc;
x2 = r2*cos(theta2) + xc;
y2 = r2*sin(theta2) + yc;
x3 = r3*cos(theta3) + xc;
y3 = r3*sin(theta3) + yc;
plot(x1,y1,'color',[1 0.5 0])
hold on
plot(x2,y2,'color',[1 0.5 0])
hold on
plot(x3,y3,'color',[1 0.5 0])
hold on
% Connecting Line:
plot([70 100], [50 50],'color',[1 0.5 0])
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0, 0, 1, 1]);
drawnow;
axis square;
for i = 1 : length(theta1)
plot(x1(i),y1(i),'r*')
pause(0.1)
end
for i = 1 : length(theta2)
plot(x2(i),y2(i),'r*')
pause(0.1)
end
for i = 1 : length(theta3)
plot(x3(i),y3(i),'r*')
pause(0.1)
end
...
circumference/r
比の実際の値は、スパイラルのために使用さ3つのカーネルのプレビューここpi2
と呼ば返しますか? – excaza
[なぜ誰かが私を助けることができますか?実際の質問ではありませんか?](http://meta.stackoverflow.com/q/284236)さらに、パートAのコードをダンプし、パートBを表示せずにパートBの努力や研究はここではあまりよく評価されていません。 – Adriaan
あなたのコメントをありがとうが、私は本当に自分でそれをやろうとしましたが、残念ながら私はできませんでした。私はここで私の質問をする以外に選択肢がありませんでした。また、パートAをパートB、私の質問を注意深く読めば、赤い星印が同心円を横切る円軌道を描くためにパートBを書いたことが分かりましたが、今度は六角軌道の同様の状況を作り出すコードを書こうと思っていますが、コードと私は同心円の六角形を作成するコードを書いています。 – zein