Basic math error?
1 回表示 (過去 30 日間)
古いコメントを表示
I'm working on writing my own orbital dynamics code; when I go to calculate the difference between two data points, I get different answers. Basically the logic is: change = new position - (old position + velocity*time); this yields a result of 0, which is not correct. I switched it to the following: change1 = new pos - old pos; change = change1 - velocity*time; which gives me a non-zero result with the correct magnitude. Its the same calculation, but I get different results!
I then try to calculate the same difference for a different planet, and while both answers are non-zero, they both differ from each other by a factor of 10^-6...
Should I change my different planet's code the same way I changed the first?
2 件のコメント
Geoff Hayes
2016 年 4 月 4 日
Niklas - can you post some of your code? Also, what data types are you using for your variables? Are they doubles, singles, unsigned integers, or ... ?
採用された回答
その他の回答 (0 件)
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!