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...
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Daniel M
le 29 Oct 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?
Réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!