How to 3D plot a bouncing ball
Show older comments
Plot 5 bounces, x and y velocities are constant.
Here is what Ive got...

All of this was done long hand.. I know there is another way but i dont know how...
What the plot should look like...

So how do I do this?
1 Comment
James
on 7 Oct 2014
Answers (2)
Chad Greene
on 7 Oct 2014
for n bounces, say 7:
v_z(1) = 17.82;
for n = 2:7
v_z(n) = .8*v_z(n-1);
end
t = 2*v_z/g;
성빈
on 6 Oct 2022
0 votes
I think it's too late, however... here's the complete code.
close all;
clear all;
alpha=25;
theta=30;
g = 9.81;
b=5;
v_0=20;
%v_x and v_y = constant
v_x = v_0*sind(theta)*cosd(alpha);
v_y = v_0*sind(theta)*sind(theta);
%v_z depreciates by 80% after every bounce
v_z = [17.82 14.256 11.405 9.124 7.299 5.839];
%time between each bounce t_b = (2*v_z)/g
t = [0 3.633 6.543 8.873 10.733 12.221];
for num = 1:1:5
tt = t(num):0.001:t(num+1);
xx = v_x*tt;
yy=v_y*tt;
zz=v_z(num)*(tt - t(num)) - 0.5*g*(tt-t(num)).^2;
plot3(xx,yy,zz);
hold on;
end
hold off;
xlabel('x');ylabel('y');zlabel('z');title('bouncing ball');
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!