Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Projectile Simulation Problem (This is driving me crazy)
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
aykut

Posts: 2
From: turkey
Registered: 12/22/13
Projectile Simulation Problem (This is driving me crazy)
Posted: Dec 22, 2013 10:24 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello everyone . I have this function that works only with Vx=15 . I have to solve it with Vx = 2 . I'm tryin to solve it for 6 hours and still couldn't find a proper plot . (sure = time
yukseklik = height . )

I guess the problem is because my Vx value is too low and matlab finds the angle as a negative value , therefore my times are negative too . I hope someone can help me i'm really desperate right now , got 4 hours left for my homework delivery .

g=10;
h0=40;
Vx=15;
Uk=0.3;

%Serbest Dü?me
t1=sqrt(h0/(0.5*g));
tt1=linspace(0,t1,100);
h1=h0-g/2*tt1.^2;

%1. Yükselme
Vy=t1*g;
a=Vy/Vx;
aci=atand(a);
h2=(Vy^2*sind(aci)^2)/(2*g);
t2=Vy*cos(aci)/g;
sure2=t1+t2;
ta1=linspace(0,t2,100);
tt2=linspace(t1,sure2,100);
h2=Vy*sind(aci)*ta1-((1/2)*g*ta1.^2);
yukseklik2=h2(100);

%1. Dü?me
t3=sqrt(yukseklik2/(0.5*g));
ta2=linspace(0,t3,100);
sure3=t1+t2+t3;
tt3=linspace(t1+t2,sure3,100);
h3=yukseklik2-g/2*ta2.^2;

%2. Yükselme
Vy=t3*g;
a=Vy/Vx;
aci=atand(a);
h4=(Vy^2*sind(aci)^2)/(2*g);
t4=Vy*sin(aci)/g;
sure4=t1+t2+t3+t4;
ta3=linspace(0,t4,100);
tt4=linspace(t1+t2+t3,sure4,100);
h4=Vy*sind(aci)*ta3-((1/2)*g*ta3.^2);
yukseklik3=h4(100);

%2. Dü?me
t5=sqrt(yukseklik3/(0.5*g));
ta4=linspace(0,t5,100);
sure5=t1+t2+t3+t4+t5;
tt5=linspace(t1+t2+t3+t4,sure5,100);
h5=yukseklik3-g/2*ta4.^2;

%3. Yükselme
Vy=t5*g;
a=Vy/Vx;
aci=atand(a);
h6=(Vy^2*sind(aci)^2)/(2*g);
t6=Vy*cosd(aci)/g;
sure6=t1+t2+t3+t4+t5+t6;
ta5=linspace(0,t6,100);
tt6=linspace(t1+t2+t3+t4+t5,sure6,100);
h6=Vy*sind(aci)*ta5-((1/2)*g*ta5.^2);
yukseklik4=h6(100);

%3. Dü?me
t7=sqrt(yukseklik4/(0.5*g));
ta6=linspace(0,t7,100);
sure7=t1+t2+t3+t4+t5+t6+t7;
tt7=linspace(t1+t2+t3+t4+t5+t6,sure7,100);
h7=yukseklik4-g/2*ta6.^2;

%4. Yükselme
Vy=t7*g;
a=Vy/Vx;
aci=atand(a);
h8=(Vy^2*sind(aci)^2)/(2*g);
t8=Vy*cosd(aci)/g;
sure8=t1+t2+t3+t4+t5+t6+t7+t8;
ta7=linspace(0,t8,100);
tt8=linspace(t1+t2+t3+t4+t5+t6+t7,sure8,100);
h8=Vy*sind(aci)*ta7-((1/2)*g*ta7.^2);
yukseklik5=h8(100);

%4. Dü?me
t9=sqrt(yukseklik5/(0.5*g));
ta8=linspace(0,t9,100);
sure9=t1+t2+t3+t4+t5+t6+t7+t8+t9;
tt9=linspace(t1+t2+t3+t4+t5+t6+t7+t8,sure9,100);
h9=yukseklik5-g/2*ta8.^2;

%5. Yükselme
Vy=t9*g;
a=Vy/Vx;
aci=atand(a);
h10=(Vy^2*sind(aci)^2)/(2*g);
t10=Vy*cosd(aci)/g;
sure10=t1+t2+t3+t4+t5+t6+t7+t8+t9+t10;
ta9=linspace(0,t10,100);
tt10=linspace(t1+t2+t3+t4+t5+t6+t7+t8+t9,sure10,100);
h10=Vy*sind(aci)*ta9-((1/2)*g*ta9.^2);
yukseklik6=h10(100);

%5. Dü?me
t11=sqrt(yukseklik6/(0.5*g));
ta10=linspace(0,t11,100);
sure11=t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11;
tt11=linspace(t1+t2+t3+t4+t5+t6+t7+t8+t9+t10,sure11,100);
h11=yukseklik6-g/2*ta10.^2;

%6. Yükselme
Vy=t11*g;
a=Vy/Vx;
aci=atand(a);
h12=(Vy^2*sind(aci)^2)/(2*g);
t12=Vy*cosd(aci)/g;
sure12=t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+t12;
ta11=linspace(0,t12,100);
tt12=linspace(t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11,sure12,100);
h12=Vy*sind(aci)*ta11-((1/2)*g*ta11.^2);
yukseklik7=h12(100);

%Sürtünme Kuvveti
%x=Vy.^2/(Uk*2*g);
t13=Vy/(Uk*2*g);
sure13=sure12+t13;
ta12=linspace(sure12,sure13,100);

% Grafik Yazd?r
plot(tt1,h1,tt2,h2,tt3,h3,tt4,h4,tt5,h5,tt6,h6,tt7,h7,tt8,h8,tt9,h9,tt10,h10,tt11,h11,tt12,h12,ta12,0);
title('dü?ey at??');
xlabel('zaman(s)');
ylabel('yükseklik(m)'),grid
disp('Toplam Süre = '),disp(sure13)



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.