How can I generate the data for an eight '8' draw?
15 ビュー (過去 30 日間)
古いコメントを表示
Hello, I would like to know how to generate the data for the shape of an eight. I've been trying with some hysteresis functions but nothing gets me close really.
Thank you very much
0 件のコメント
採用された回答
David Sanchez
2013 年 6 月 13 日
You can try with this:
t=0:.1:2*pi;
x = -sin(t);
y = sin(t);
plot(t,x,'*',t,y,'+')
2 件のコメント
その他の回答 (2 件)
Paulo Barbosa
2016 年 9 月 15 日
div = pi/50; % Resolution
sz = 100; % Number of Points in 2 Pi
th = zeros(1,sz);
th(1) = pi; % Starting at (0,0) and going up.
for i = 2:sz
th(i) = th(i-1)-div;
end
circ_x = fat*cos(th);
circ_y = fat*sin(th);
x1 = circ_x(1:26);
y1 = circ_y(1:26);
% -------------------------------------------
th(1) = 0;
for i = 2:sz*fat
th(i) = th(i-1)+div*fat;
end
cos_x = th;
cos_y = fat*cos(th/fat);
x2 = cos_x(1:51);
y2 = cos_y(1:51);
% -------------------------------------------
th(1) = -pi/2;
for i = 2:sz
th(i) = th(i-1)+div;
end
circ_x = fat*cos(th);
circ_y = fat*sin(th);
x3 = circ_x(1:51)+16;
y3 = circ_y(1:51);
% -------------------------------------------
x4 = x2';
x4 = flipud(x4);
x4 = x4';
y4 = y2';
y4 = flipud(y4);
y4 = -y4';
% -------------------------------------------
th(1) = -pi/2;
for i = 2:sz
th(i) = th(i-1)-div;
end
circ_x = fat*cos(th);
circ_y = fat*sin(th);
x5 = circ_x(1:26);
y5 = circ_y(1:26);
% -------------------------------------------
x = [x1 x2 x3 x4 x5];
y = [y1 y2 y3 y4 y5];
% A plot so you can see each section
figure
hold on
plot(x1,y1,'.r');
plot(x2,y2,'.b');
plot(x3,y3,'.k');
plot(x4,y4,'.g');
plot(x5,y5,'.y');
Carmelo Fabrizio Blanco
2020 年 11 月 3 日
t = [0:0.001:10];
f = 10;
x = sin(2*pi*t*f);
y = sin(2*pi*t*2*f);
figure();
plot(x,y);
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!