How can I generate the data for an eight '8' draw?
14 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
jadaslg
il 13 Giu 2013
Risposto: Carmelo Fabrizio Blanco
il 3 Nov 2020
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 Commenti
Risposta accettata
David Sanchez
il 13 Giu 2013
You can try with this:
t=0:.1:2*pi;
x = -sin(t);
y = sin(t);
plot(t,x,'*',t,y,'+')
2 Commenti
Più risposte (2)
Paulo Barbosa
il 15 Set 2016
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
il 3 Nov 2020
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 Commenti
Vedere anche
Categorie
Scopri di più su Line Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!