Someone please optimize this code or write is a little different, so that it doesn't take that much time to run. I really need it, I'd appreciate it alot!
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
close all
format long
caught = false;
w = 1.61803;
while ~caught
w = w + 0.0000010000000000;
N = 100000000;
x = zeros(N, 1);
y = zeros(N, 1);
t = 0;
dt = 1 / (N - 1);
for k = 2:N
xp = t - x(k-1);
yp = 1 - y(k-1);
C = w / sqrt(xp * xp + yp * yp);
xp = C * xp;
yp = C * yp;
x(k) = x(k-1) + dt * xp;
y(k) = y(k-1) + dt * yp;
if (y(k-1) < 1) && (y(k) >= 1)
caught = true;
w
y(k-1);
y(k);
k;
end;
t = t + dt;
end
end
Someone please optimize this code or write is a little different, so that it doesn't take that much time to run. I really need it, I'd appreciate it alot!
6 comentarios
Walter Roberson
el 29 de Oct. de 2019
omega =
1.609883999957745
is output within a reasonable time.
Respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!