How can I draw a trajectory like this?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Zeinab Ahmadi93
el 28 de Jun. de 2017
Comentada: Zeinab Ahmadi93
el 2 de Jul. de 2017
Hello everybody Would you help me draw a trajectory like this using sin and cos functions but not with these stars, I want it with solid and continuous line.I have found this piece of code but i couldn't get a clue. Thanks in advance.
c1=30;
c2=30;
for j=1:3
for i=1:1:8 %%%2nd for loop for no. of S in the column
if(mod(i,2)~=0) %%%for C structure and opposite C structure
th = linspace( pi/2, -pi/2, 10);
for k=1:1:length(th)
anchormove(1,idx) = r *-cos(th(k)) + c1;
anchormove(2,idx) = r *-sin(th(k)) + c2;
idx=idx+1;
end
else
th = linspace( -pi/2, pi/2, 10);
for k=1:1:length(th)
anchormove(2,idx) = r * sin(th(k)) + c2;
anchormove(1,idx) = r * cos(th(k)) + c1;
idx=idx+1;
end
end
c2=c2+60;
end
lastmove=anchormove(2,idx-1);
for i=anchormove(1,idx-1):10: anchormove(1,idx-1)+(r+60)
anchormove(1,idx) = i;
anchormove(2,idx) = lastmove;
idx=idx+1;
end
c2=450;
c1=c1+90;
for i=1:1:8 %%%2nd for loop for no. of S in the column
if(mod(i,2)~=0) %%%for C structure and opposite C structure
th = linspace( pi/2, -pi/2, 10);
for k=1:1:length(th)
anchormove(1,idx) = r *cos(th(k)) + c1;
anchormove(2,idx) = r *sin(th(k)) + c2;
idx=idx+1;
Ax=anchormove(1,i);
Ay=anchormove(2,i);
plot(Ax,Ay,'r*')
0 comentarios
Respuesta aceptada
Image Analyst
el 28 de Jun. de 2017
Use 'r-' instead of 'r*'.
3 comentarios
Image Analyst
el 28 de Jun. de 2017
Editada: Image Analyst
el 28 de Jun. de 2017
Attach your code here. I'm not going out to any third party site when you can attach it here with the paper clip icon. Your code as pasted above doesn't work. There are at least 3 "end" statement missing. I don't know where to put them because the formatting and indenting is all messed up. You can type control-a then control-i to fix indenting before pasting here. Please post code that runs.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!