[关闭]
@feipai11 2016-04-20T20:27:39.000000Z 字数 3403 阅读 1558

Cannon shell: Let it fly for a moment

郭帅斐


The summery:

This is the first trajectory problem. Different from the problem in chaper1, there are two or three varibles in the problem. We can still use the Euler mathod to calculate the next state varibles through the current state values. As an object fly in the sky, we must consider the gravity and the drag force of the air. More precisely, we must take the density of the air changing with the height into account. We can find that the drag force has a strong effect on the trajectory of the cannon shell, which make the shell fly a shorter distance. And, the density change cause the shell to fly farther。

The pseudocode:

This is the first time to use class defination, and I found that the class and object make the codes more operational and more portable. Object orientation help us operate many similar initial conditions easily. The initial section is worked out by another class defination, named flight_state, through which we can initial the position and velocity as a whole. At the calculate section, I only list the most complex one as follows:





The store and show section are completed by two function. That is not to say.

The result:

The conclusion:

Through the first class progrem, We analysed the projectile motion of the cannon shell. We drawed the conclusion: (1) Object orientation progreming can be more efficient compared to normal progreming. (2) Big angle shell suffer a more serious influence not only from the airdrag but also from the air density change. (3) With all the factors considered the angle 42.5 gained the farest diatance.

Acknowledgement:

The code is mainly adapted from Professor Cai, so I would like to thank him.
Some detials are discussed with LiFangying, who give me many inspirations.

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注