Rocket release time error

1 visualización (últimos 30 días)
al
al el 10 de En. de 2025
Comentada: al el 11 de En. de 2025
Hello,
I made a previous post about a rocket simulation project I have. I am still stuck on the same project, but I managed to solve some of the problems. The current issue is some errors I get when I run problem c). My theory, after some debuging is that the issue is somwhere between row 260 and 271. Can anyone explain what these errors are from and how I can fix them?
Enter which problem ao run, a, c or d, enter problem: c
268 elseif tu<params_mini(3)
Index exceeds the number of array elements. Index must not exceed 4.
Error in testador>@(vx)(problem_main(5)*cosd(problem_param(5))-problem_main(4)*vx*V)/total_mass (line 311)
dvxdt = @(vx) (problem_main(5) * cosd(problem_param(5)) - problem_main(4) * vx * V) / total_mass;
Error in testador>Rungekutta (line 318)
k1vx = dvxdt(problem_param(3)); k1vy = dvydt(problem_param(4));
Error in testador>trajectory (line 269)
params = Rungekutta(params, user_inp, access_keys, dt_unrefined); % Runs mini rocket
Error in testador (line 32)
Height_distance = trajectory(params, user_inp, access_keys); % Pass params.c to rungekutta
  3 comentarios
al
al el 11 de En. de 2025
Thanks for the help finding the issue!
I have now realised that the actual issue may occur much earlier, somwhere in row 215 to 231. It also seems I asigned position vector incorrectly. It was a 8x8 matrix instead of a 1x8 row vector. The main issue at the moment seems to be that the time counter tj for some reason can never exceed 3. My theory is that this later on causes errors, when we change our values to be the same as the values asigned to the current position array. This would explain why it suddenly drops from 4 to 0. Does anyone know how to resolve this error or if that is not the main cause?
New/updated code attached
al
al el 11 de En. de 2025
I think I just solved it!
Thank you so much for the help! It seems the issue lied in the fact that I forgot to asign a value for when our time tj = 3. In previous code, this was never a big issue, since our time step was smaller and more percise. The issue was that the time will be exactly 3 and I never asigned a value/scenario on what to do when this happens.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by