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!