0% found this document useful (0 votes)
16 views3 pages

FINAL R4.m

Uploaded by

maxvg06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

FINAL R4.m

Uploaded by

maxvg06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

clear

% Situation 1
dt = 0.001
Theta = 43.5
v0 = 8.2
k1 = 0.15
g = 9.8

vx(1) = v0*cosd(Theta);
vy(1) = v0*sind(Theta);

x(1) = 0;
y(1) = 0;
t = 1;
while y(t) >= 0

vx(t+1) = vx(t)+(-k1*vx(t))*dt;
vy(t+1) = vy(t)+(-g-k1*vy(t))*dt;

x(t+1) = x(t)+vx(t)*dt;
y(t+1) = y(t)+vy(t)*dt;

t = t + 1;
end
figure

% Situation 2
dt = 0.001
Theta = 43.5
v0 = 8.2
k2 = 0.10
g = 9.8

vx1(1) = v0*cosd(Theta);
vy1(1) = v0*sind(Theta);

x1(1) = 0;
y1(1) = 0;
t = 1;
while y1(t) >= 0

vx1(t+1) = vx1(t)+(-k2*vx1(t))*dt;
vy1(t+1) = vy1(t)+(-g-k2*vy1(t))*dt;

x1(t+1) = x1(t)+vx1(t)*dt;
y1(t+1) = y1(t)+vy1(t)*dt;

t = t + 1;
end
figure

% Situation 3
dt = 0.001
Theta = 43.5
v0 = 8.2
k3 = 0.05
g = 9.8
vx2(1) = v0*cosd(Theta);
vy2(1) = v0*sind(Theta);

x2(1) = 0;
y2(1) = 0;
t = 1;
while y2(t) >= 0

vx2(t+1) = vx2(t)+(-k3*vx2(t))*dt;
vy2(t+1) = vy2(t)+(-g-k3*vy2(t))*dt;

x2(t+1) = x2(t)+vx2(t)*dt;
y2(t+1) = y2(t)+vy2(t)*dt;

t = t + 1;
end
figure

% Situation 3
dt = 0.001
Theta = 43.5
v0 = 8.2
k4 = 0.00
g = 9.8

vx3(1) = v0*cosd(Theta);
vy3(1) = v0*sind(Theta);

x3(1) = 0;
y3(1) = 0;
t = 1;
while y3(t) >= 0

vx3(t+1) = vx3(t)+(-k4*vx3(t))*dt;
vy3(t+1) = vy3(t)+(-g-k4*vy3(t))*dt;

x3(t+1) = x3(t)+vx3(t)*dt;
y3(t+1) = y3(t)+vy3(t)*dt;

t = t + 1;
end
figure

plot(x,y,x1,y1,x2,y2,x3,y3)

%Valores importados de Traker


xreal =
[0.024,0.192,0.392,0.602,0.812,1.012,1.222,1.411,1.621,1.821,2.021,2.241,2.431,2.63
0,2.830,3.029,3.229,3.418,3.607,3.828,4.007,4.206,4.406,4.595,4.784,4.973,5.173,5.3
73,5.562,5.762,5.972,6.161,6.350]
yreal = [0.000, 0.231, 0.388,
0.546,0.714,0.830,0.945,1.061,1.141,1.240,1.313,1.376,1.429,1.471,1.492,1.502,1.502
,1.492,1.471,1.450,1.408,1.366,1.292,1.208,1.135,1.019,0.924,0.798,0.662,0.504,0.33
6,0.168,-0.032]

%Gráfica de simulación más parecida a la real


plot(xreal,yreal, x1,y1)

You might also like