I have one function (Golf_Projectile_DragMagnus) which outputs the final distance reached by a golf ball with varying factors that affect the distance if ran numeruous times. And the function below which is meant to find the mean distance reached after multiple iterations. Since the answer for the first function is always different I need to run it each time before it adds to the Total. The output of my first function is only the scalar of distance reached.
N_Iterations = 1000;
Total = 0;
Total = Total + FinalImpact;
Mean = Total/N_Iterations;
I have tried to make the variable FinalImpact global in the Golf_Projectile_DragMagnus function however that does not seem to work. Thank you for your response in advance.