# I need help coding a human cannonball ignoring air resistance

조회 수: 12(최근 30일)
Tiffany Orogun 2020년 3월 11일
댓글: Jim Riggs 2020년 3월 13일
I need to make a code on matlab for a human cannon ball, without taking drag into account. It's meant to be a simple code but i've only seen complicated solutions for the cannonball. I need it to be at an angle of 45. The cannonball angle has to be a vector. If possible without needing a while loop.
##### 댓글 수: 1표시숨기기 없음
darova 2020년 3월 11일
Do you have any attempts? What problems are yuo facing?

댓글을 달려면 로그인하십시오.

### 답변(1개)

Jim Riggs 2020년 3월 12일
편집: Jim Riggs 2020년 3월 12일
Assuming zero drag and relatively low muzzle velocity ( acceleration due to gravity = constant), the point-mass trajectory can be described by simple kinematic relationships.
(See derivations in the attached paper) ##### 댓글 수: 2표시숨기기 이전 댓글 수: 1
Jim Riggs 2020년 3월 13일
The reason that tghe second plot does not stop in the correct place is because you have defined the time span incorrectly for the second case.
You used the same horizontal velocity (v) for both. The second case (for t2) should use v2.
t = (2*v*sind(angle))/9.81; %We have used the equation t = (2*initial_velocity*angle)/g
% in order to calculate the time that it will take for this specific trajectory
% using our chosen values for the velocity and angle
t2 = (2*v*sind(angle2))/9.81;
(Also, you should get in the habit of NEVER hard-coding numeric constants in equations.
Use g=-9.81 or grav = -9.81 Ths will make your code more versitile in the future when you want to run the same calculation, but account for variations in g due to lattitude, (or on Mars, maybe) )

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!