How can I draw a graph to plot the relationship between launch angle and horizontal distance travelled by a shuttlecock? (f=kv^2)

5 Ansichten (letzte 30 Tage)
I am writing for my IB math internal assessment. I study the projectile of shuttlecock with air resistance. f=kv^2
The below shows my unfinished work. I don't know how to modify it.
I'd like to figure out the relationship between launch angle and horizontal range under a given initial velocity (e.g.28m/s)
My ideal version is like this:
If I input initial velocity and initial position (x,y coordinates), a graph consisting of launch angle (0-90°) and horizontal range will run automatically.
v0 = 'What is the Initial Velocity? ';
v0 = input(v0);
theta = 'What is the Angle in degree? ';
theta = input(theta);
y0 = 'What is the Initial Y position? ';
y0 = input(y0);
m = 0.005; %mass/kg
k = 0.001008; %air resistance: f = -k * v^2
g = 9.8; %gravity
vx0 = v0 * cosd(theta);
vy0 = v0 * sind(theta);
z0 = [vx0, vy0]; %original position vector
x0 = 0; %original x-coordinate
f = @(t,z) [-k * z(1) * sqrt(z(1)^2 + z(2)^2) / m; -k * z(2) * sqrt(z(1)^2 + z(2)^2) / m - g];
[T, Z] = ode45(f, [0, 2], z0);
vx = Z(:,1);
vy = Z(:,2);
x = x0;
y = y0;
for i = 1:length(T)-1
tempx = x(i) + vx(i) * (T(i+1) - T(i));
tempy = y(i) + vy(i) * (T(i+1) - T(i));
x = [x;tempx];
y = [y;tempy];
end
plot(x, y)
hold on
plot([2,2],[0,1.55],'k') % Draw the wall
Hope to see a perfect solution! Thanks so much!

Antworten (0)

Kategorien

Mehr zu Earth and Planetary Science finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by