increasing the launch angle of projectile so it reaches a certain distance

3 ビュー (過去 30 日間)
Amit
Amit 2013 年 4 月 13 日
I am currently doing a school project where i have to plot the trajectory of a projectile launched from the ground with initial speed u, and angle theta above the horizontal. The projectile has to hit a target of a horizontal distance D=10000m away once it has reached the ground. I have used an initial guess of theta=pi/12 as the angle, so that the projectile does not reach D. The program should then automatically pick a new value of theta by increasing theta from pi/30 in steps dtheta=theta/100 until the target is overshot. A parachute is deployed at t_pchute=15 seconds.
How do I increase the angle iteratively such that the projectile reaches the target? I was told to use theta(i+1)=atan(vy(i)/vx(i)), but i'm not sure why. If you have time, please help me.
%Constants
D=10000;%m
u=600;%m/s
m=50;%kg
t_pchute=15;%s
g=9.81;%m/s^2
a_proj=0.01;%m^2
a_pchute=0.05;%m^2
C_proj=0.4;
C_pchute=1.2;
p0=1.207;%kg/m^3
theta=pi/12;
dtheta=theta/100;
%initial conditions
x=0;
i=0;
t=0;
y=0;
dt=0.1;
p=p0;
vx=u*cos(theta);
vy=u*sin(theta);
v=sqrt(vx.^2+vy.^2);
for i=1:1000
Fa(i+1)=0.5*p(i)*C_proj*a_proj*v(i);
Fp(i+1)=0.5*p(i)*C_pchute*a_pchute*v(i);
if t<t_pchute
ax(i+1)=-((Fa(i)*cos(theta(i)))/m)*vx(i);
ay(i+1)=-g-(((Fa(i)*sin(theta(i)))/m)*vy(i));
else
ax(i+1)=-((Fp(i)*cos(theta(i)))/m)*vx(i);
ay(i+1)=-g-(((Fp(i)*sin(theta(i)))/m)*vy(i));
end
vx(i+1)=vx(i)+(dt.*ax(i));
vy(i+1)=vy(i)+(dt.*ay(i));
v(i+1)=sqrt(vx(i).^2+vy(i).^2);
x(i+1)=x(i)+(dt.*vx(i));
y(i+1)=y(i)+(dt.*vy(i));
p(i+1)=p0*(1-2.333e-5*y(i+1)).^5;
theta(i+1)=atan(vy(i)/vx(i));
t=t+dt;
if y(i+1)<0
break
end
end
plot(x,y),grid
xlabel('Distance/[m]')
ylabel('Height/[m]')
title('Projectile Trajectory')
  2 件のコメント
Amit
Amit 2013 年 4 月 13 日
sorry, my apologies. it was inconsiderate of me. I have now deleted the other two questions.

サインインしてコメントする。

回答 (2 件)

Jürgen
Jürgen 2013 年 4 月 14 日
Hi, I admint I did not check all your code, but
if you want something like:
theta= Value;
thetaStep= StepValue;
for i= 1:someValue
Theta= Theta+ StepValues*(i-0);
do something with theta
end
then I find it strange that you use Theta/100 as step value because your step is then a function of Theta, or is that done deliberately?
R,J
  3 件のコメント
Jürgen
Jürgen 2013 年 4 月 15 日
while horFlightDist < 1000
do something
end
Amit
Amit 2013 年 4 月 15 日
Thanks. I tried doing that but I get a funny looking graph. I'm also not sure where to put the while loop?

サインインしてコメントする。


Amit
Amit 2013 年 4 月 15 日
can anyone help? thanks.

カテゴリ

Help Center および File ExchangeDialog Boxes についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by