How can I generate the data for an eight '8' draw?
조회 수: 14 (최근 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
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!