Back to Problem Solutions forum
Hello.
I'm working on Safe Landing problem and I don't understand thing about simulation step (dt = 0.1).
Am I right, that we do all calculations (increasing decreasing variables) on each 0.1 step, but reread from input burning rate only, then dt is multiple of 10 (dt % 10 == 0)? And should we read burning rate from input at the begin (dt == 0.0) or it should be equal to 0?
Thanks!
BTW, I submit my code, so those who already solve this problem can look at it and maybe give me a hint, what is wrong.
Hi,
Your simulation should be calculated every 0.1 of a second and the burning rate should be read at the start and then every 10 seconds.
Your code has i%10 not dt%10, so when i is a multiple of 10 I think only 1 second has elapsed.
I don't understand why your code has this in one place
height -= velocity * dt;
velocity += g*dt - dV;
and this in another place
height -= velocity;
velocity += g;
Also, if dt is the simulation step, and you use it in calculating changes in height and velocity, I don't think it makes sense to keep changing dt.
Thank you very much! Solved it.