Could someone please tell me which value of omega you get for steps = 100, 500, 1000, 5000, 10000? My laptop can't handle the processing...

1 visualización (últimos 30 días)
clear;
close all;
clc;
format long
caught = false;
omega = 0;
while ~caught
omega = omega + 0.000001;
T = 1;
steps = 100;
x = zeros(steps, 1);
y = zeros(steps, 1);
t = 0;
dt = T / (steps - 1);
for i = 2:steps
xSecond = t - x(i - 1);
ySecond = 1 - y(i - 1);
C = omega / sqrt(xSecond * xSecond + ySecond * ySecond);
xSecond = C * xSecond;
ySecond = C * ySecond;
x(i) = x(i-1) + dt * xSecond;
y(i) = y(i-1) + dt * ySecond;
if (y(i-1) < 1) && (y(i) >= 1)
caught = true;
omega
y(i-1);
y(i);
i;
break;
end;
if caught; break; end;
t = t + dt;
end;
end;
Could someone please tell me which value of omega you get for steps = 100//500/1000//5000/10000? My laptop can't handle the processing...
  1 comentario
Daniel M
Daniel M el 29 de Oct. de 2019
Running it with steps = 100, took 159378516 iterations of the for loop. Do you really need to increase the number of steps? Your stepsize for omega is also incredibly small. How much precision do you really require?

Iniciar sesión para comentar.

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by