# How to keep equal distancing between markers while moving??

1 visualización (últimos 30 días)
MSolano el 10 de Jun. de 2021
Comentada: MSolano el 11 de Jun. de 2021
Hi, how can I keep equal distancing (angles) between markers while moving so that they move at he same speed (f=0.5)?
Thank you!
clear
clc
figure
n= 10; % Number of points
f = 0.5 ; % frequency
r = 2 ; % Ratio
theta= linspace(0,360,n+1);
pp = plot(NaN,NaN,'o') ;
axis(1.1*[-r r -r r]) ;
axis square
tic
while(toc < 10)
t = toc ;
pp.XData = [r*cosd(theta*f*t)] ;
pp.YData = [r*sind(theta*f*t)] ;
drawnow
end
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

SALAH ALRABEEI el 11 de Jun. de 2021
Since you are in a periodic space, scaling the angle will not preserve the distance, you should use addition ( translate the angle)
pp.XData = [r*cosd(theta + f*t)] ;
pp.YData = [r*sind(theta + f*t)] ;
It will be too slow, but you can make it faster by scaling the the frequency 1*45 ( pi/4) or 90 ( pi/2). As you want
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
MSolano el 11 de Jun. de 2021
Thanks again! :D

Iniciar sesión para comentar.

### Categorías

Más información sobre Graphics Performance en Help Center y File Exchange.

R2021a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by