Rocket release time error
Show older comments
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 Comments
My guess is that either the array "problem_main" or the array "problem_para" only had four elements when the function handle for dvxdt was created, but you try to access the fifth (which does not exist) in the function definition
dvxdt = @(vx) (problem_main(5) * cosd(problem_param(5)) - problem_main(4) * vx * V) / total_mass;
al
on 11 Jan 2025
al
on 11 Jan 2025
Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!